cvs commit: src/lib/libc/string strcspn.c strspn.c src/sys/libkern strspn.c

Joerg Sonnenberger joerg at britannica.bec.de
Sat Apr 2 10:59:44 PST 2005


On Sat, Apr 02, 2005 at 06:52:45PM +0000, David Schultz wrote:
>   Replace the current strspn() and strcspn() with significantly faster
>   implementations inspired by the ones in DragonFly.  Unlike the
>   DragonFly versions, these have a small data cache footprint, and my
>   tests show that they're never slower than the old code except when the
>   charset or the span is 0 or 1 characters.  This implementation is
>   generally faster than DragonFly until either the charset or the span
>   gets in the ballpark of 32 to 64 characters.

The trade off is between bzero(256) and an additional bit operation
per input and charset byte. I was thinking about doing it with bit-ops,
but I haven't had the time for actual benchmarks so I choose the
simpler version.

Joerg


More information about the cvs-src mailing list