Date: Sun, 3 Apr 2005 01:06:22 +0200 From: Olivier Houchard <cognet@ci0.org> To: src-committers@FreeBSD.ORG, cvs-src@FreeBSD.ORG, cvs-all@FreeBSD.ORG Cc: David Schultz <das@FreeBSD.ORG> Subject: Re: cvs commit: src/lib/libc/string strcspn.c strspn.c src/sys/libkern strspn.c Message-ID: <20050402230622.GA65020@ci0.org> In-Reply-To: <20050402185706.GA19208@VARK.MIT.EDU> References: <200504021852.j32IqjhR031587@repoman.freebsd.org> <20050402185706.GA19208@VARK.MIT.EDU>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Apr 02, 2005 at 01:57:06PM -0500, David Schultz wrote: > On Sat, Apr 02, 2005, David Schultz wrote: > > das 2005-04-02 18:52:44 UTC > > > > FreeBSD src repository > > > > Modified files: > > lib/libc/string strcspn.c strspn.c > > sys/libkern strspn.c > > Log: > > 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. > > BTW, anyone know a good reason why we have optimized string > functions (e.g. strcmp(), strcpy()) in libc, but not in libkern? > In testing strcmp(s, s), I found that the libc version on i386 is > 11% faster when s has length 1 and 4% faster when s has length 400. > > The kernel has many consumers of these functions, but maybe their > performance is irrelevant in the grand scheme of things. > Certainly things like bcopy and bswap are more important... For what it worth, I noticed a small performance increase when using optimized versions of strcmp and strncmp in libkern on arm, so it might be a good idea. Olivier
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050402230622.GA65020>