Date: Thu, 08 Jan 2009 20:26:31 -0800 From: Xin LI <delphij@delphij.net> To: "Sean C. Farley" <scf@FreeBSD.org> Cc: d@delphij.net, freebsd-arch@FreeBSD.org Subject: Re: RFC: MI strlen() Message-ID: <4966D1F7.1040105@delphij.net> In-Reply-To: <alpine.BSF.2.00.0901082137210.1315@baba.farley.org> References: <4966B5D4.7040709@delphij.net> <alpine.BSF.2.00.0901082137210.1315@baba.farley.org>
next in thread | previous in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Sean, Sean C. Farley wrote: > 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 Yes, but nothing gets committed :-/ I think I had lost that work due to a hard disk failure. > 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? Hmm... I did not thought about it, but looking at your code, it seems that using #error makes it more obvious. I have put the revised version at: http://people.freebsd.org/~delphij/for_review/strlen-r1.diff For those who wants to see the file instead of the diff: http://people.freebsd.org/~delphij/for_review/strlen.c Cheers, - -- Xin LI <delphij@delphij.net> http://www.delphij.net/ FreeBSD - The Power to Serve! -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (FreeBSD) iEYEARECAAYFAklm0fcACgkQi+vbBBjt66DWMgCePfKWpIzThVYBRd41lJ3t85KU UrUAoLyiCnnLBBgWk2YbevkZcxHI6XQy =Qhk+ -----END PGP SIGNATURE-----
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4966D1F7.1040105>