PATCH: Optimize memcmp for ia32

H. J. Lu hjl@lucon.org
Mon Feb 9 18:27:00 GMT 2004


On Fri, Feb 06, 2004 at 11:27:30PM -0800, Ulrich Drepper wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> H. J. Lu wrote:
> 
> > I tested it on all available Pentium 4/M processors.
> 
> And because of your tests with P4s you replace the code for generic
> i386?  Not very logical, is it?

I don't think anyone will be happy to run the current glibc on anything
less than Pentium Pro.

> 
> Furthermore, the test case code is not a realistic benchmark.  For this
> you need to know the usual string sizes which happen on a normal system.
>  Do you have this data?  Well, I have some code which does measurements
> of the use of all string functions.  And guess what the outcome is?
> memcmp in the libc is not used at all during a normal system start and
> shutdown.  I've even started OO.o.
> 

The patch is to improve the speed of memset in glibc. Programs which
use memset in glibc will benefit from it. One of them is gcc:

# nm -D /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/cc1| grep memset
	U memset

We can investigate how often it is called in gcc. But it is used by
some applications and my patch will help them.


H.J.



More information about the Libc-alpha mailing list