RFC: MI strlen()

Xin LI delphij at delphij.net
Mon Jan 12 22:54:05 PST 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Dag-Erling Smørgrav wrote:
> Xin LI <delphij at delphij.net> writes:
>> Here is a new implementation of strlen() which employed the bitmask
>> skill in order to achieve better performance on modern hardware.
> 
> Why bother?  Do we have code that uses strlen() heavily in performance-
> critical regions?  Does anybody?

I agree that strlen() should never be used in performance-sensitive
regions, but given we do not have assembly optimized versions of these
functions for amd64 and almost everybody else has it, having a C version
that gives similar performance is valuable.  Also, worldstone with -j9
on 2x4core machine with both src/ and obj/ in tmpfs, seems to have
small, but positive effect:

Unpatched libc:
     1400.97 real      4159.34 user      2901.08 sys
     1396.73 real      4159.06 user      2906.16 sys
     1380.27 real      4158.20 user      2803.22 sys

Patched libc:
     1363.29 real      4154.89 user      2749.94 sys
     1373.96 real      4150.45 user      2830.46 sys
     1368.62 real      4152.48 user      2838.52 sys

(with 'make cleanworld' between builds)

Cheers,
- --
Xin LI <delphij at delphij.net>	http://www.delphij.net/
FreeBSD - The Power to Serve!
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.9 (FreeBSD)

iEYEARECAAYFAklsOoAACgkQi+vbBBjt66COQgCfTmpQK9YliCxpdJkckJ2/cZim
NzEAoKRqC2HN1FtKRWaZhstYyVjYeewr
=eeea
-----END PGP SIGNATURE-----


More information about the freebsd-arch mailing list