Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Jan 2009 22:04:30 -0600 (CST)
From:      "Sean C. Farley" <scf@FreeBSD.org>
To:        d@delphij.net
Cc:        freebsd-arch@FreeBSD.org
Subject:   Re: RFC: MI strlen()
Message-ID:  <alpine.BSF.2.00.0901082137210.1315@baba.farley.org>
In-Reply-To: <4966B5D4.7040709@delphij.net>
References:  <4966B5D4.7040709@delphij.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 8 Jan 2009, Xin LI wrote:

> Hi,
>
> Here is a new implementation of strlen() which employed the bitmask 
> skill in order to achieve better performance on modern hardware.  For 
> common case, this would be a 5.2x boost on FreeBSD/amd64.  The code is 
> intended for MI use when there is no hand-optimized assembly.
>
> 	http://people.freebsd.org/~delphij/for_review/strlen.diff
>
> Note that this version of strlen() has suboptimal performance if there
> are a lot of characters that has their highest bit set (we can change 
> it to have uniform performance at the expense of about ~30% 
> performance penalty).
>
> Comments?

I only glanced over it, but I like the idea about having it.

I see that you investigated this before[1]?  Amusingly, I did something 
similar two years later[2] with a C version of strlen()[3].  :)

Out of curiosity, is an assert (i.e., CTASSERT) better than an #error?

Sean
   1. http://lists.freebsd.org/mailman/htdig/freebsd-arch/2005-August/004076.html
   2. http://lists.freebsd.org/pipermail/freebsd-arch/2007-July/006636.html
   3. http://www.farley.org/freebsd/tmp/strlen/strlen.c
-- 
scf@FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?alpine.BSF.2.00.0901082137210.1315>