Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 2 Apr 2005 20:57:27 +0200
From:      Joerg Sonnenberger <joerg@britannica.bec.de>
To:        cvs-src@freebsd.org
Subject:   Re: cvs commit: src/lib/libc/string strcspn.c strspn.c src/sys/libkern strspn.c
Message-ID:  <20050402185727.GA91669@britannica.bec.de>
In-Reply-To: <200504021852.j32IqjhR031587@repoman.freebsd.org>
References:  <200504021852.j32IqjhR031587@repoman.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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



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