Assembly string functions in i386 libc

Sean C. Farley scf at FreeBSD.org
Thu Jul 12 04:19:49 UTC 2007


On Wed, 11 Jul 2007, Matthew Dillon wrote:

> :Since strlen() is used in every program directly or indirectly through
> :libc, I thought it was beneficial to make it faster.  In the case of
> :i386, the C version used by all the other architectures, except for ARM,
> :is much faster that the assembly version.  This is without any
> :optimization on its part.
> :
> :I need to test out grep (FreeGrep) to see how it behaves when calling
> :regexec() (may use strlen() in certain cases) many times (i.e., grep -R
> :on the source tree) using both versions.
>
>    Yes, but there's a difference between using strlen() a couple of
>    times in the program and using it in a core processing loop or
>    other high-performance element of the program.  And even if it is
>    used in such places it isn't going to be used so often that the
>    program would actually benefit from the few nanoseconds of
>    improvement you might get from it.  The chances of that are nearly
>    zero.

I tested it with diff and saw no difference :) between the assembly
version and mine.  I would still recommend to use the C version
(src/lib/libc/string/strlen.c) over the assembly version since the
assembly version adds no value while the C version is used already for
most of the other architectures.  Obviously, there is no rush.

Sean
-- 
scf at FreeBSD.org


More information about the freebsd-arch mailing list