bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

glibc suggested speed improvement to strcasestr.c


From: Digital
Subject: glibc suggested speed improvement to strcasestr.c
Date: Thu, 8 Apr 2004 01:49:08 -0700
User-agent: KMail/1.6.1

Reason for sending in this fix:
Looking at strcasestr.c, it appears that it can be made faster by removing 
the calls to _tolower from the loops and doing a 1x pretest for upper and 
lower case before looping.

I tried compiling the glibc-2.3 library while using mandrake 8 and ran into 
trouble then, so I am no expert on configuring the library for making a 
patch, but I did make an update (attached strcasestr.c) and tested it 
separately, so it should be fairly easy to merge & test (for a more 
experienced library maintainer) since I believe it is spellchecked, 
tested, verified, ...except for the last step of actually testing within 
the glib library as it should be done.

-------------3 files inside glibc-strcasestr.tar.gz--------
Included in this email is an updated version of strcasestr.c with the 
faster looping method (replacing variables b & c with bl bu & cl cu
glibc-2.3.2 was used for creating this latest update to strcasestr.c
The current glibc strcasestr.c is located in:
glibc-2.3.2/sysdeps/generic/strcasestr.c

Also included is a diff file between the existing strcasestr.c found in the 
library and the new attached strcasestr.c
this was made using the diff utility as:
diff glibc-2.3.2/sysdeps/generic/strcasestr.c strcasestr.c >>diff.txt

Final file included is strcasestrtest.c which was used to test strcasestr.c
Unfortunately, as mentioned earlier, I had trouble testing glibc-2.3 using 
mandrake 8, therefore (even though I'm using mandrake 10 right now), I 
still thought it best to test it as a separate routine in case I ran into 
trouble again :-(
---------------
I hope the improvement shown help strcasestr.c to search faster.
If you have any questions or suggestions, please send a reply, thanks.

Attachment: glibc-strcasestr.tar.gz
Description: application/tgz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]