This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fwd: glibc suggested speed improvement to strcasestr.c


Hello,
I'm sending this yet a 3rd time.... hopefully 3rd-time-is-a-charm  ;-)

From: "Alfred M. Szmidt" <ams@kemisten.nu>
 To: Digital@JoesCat.com
 CC: bug-glibc@gnu.org, gnu@gnu.org
 
? ?I did not see any response or acknowledgement from
? ?bug-glibc@gnu.org So I am re-sending this once again.

Send it to libc-alpha@sources.redhat.com, no glibc developers read
this list.


----------  Forwarded Message  ----------

From: Digital <Digital@JoesCat.com>
Reply-To: Digital@JoesCat.com
Organization: Joe's Cat
X-KMail-Identity: 1020967833
Subject: Fwd: glibc suggested speed improvement to strcasestr.c
Date: Mon, 19 Apr 2004 18:37:43 -0700
User-Agent: KMail/1.6.1
X-KMail-Link-Message: 10494
X-KMail-Link-Type: forward
To: bug-glibc@gnu.org
Cc: gnu@gnu.org
MIME-Version: 1.0
Content-Type: Multipart/Mixed;
  boundary="Boundary-00=_n7HhAG5d4Aw1KFv"
Message-Id: <200404191837.43224.Digital@JoesCat.com>
Status: RO
X-Status: RS
X-KMail-EncryptionState: N
X-KMail-SignatureState: N
X-KMail-MDN-Sent:  

Hello bug-glibc@gnu.org,
I did not see any response or acknowledgement from bug-glibc@gnu.org
So I am re-sending this once again.

Attached you should find a suggested improvement for strcasestr.c which
 should help speed it up a little. So instead of repeatedly doing a
 tolower() call within the search loops, it does a onetime tolower() and
 toupper() call outside the main search loops. this reduces the main loops
 to simply comparing values without having to precalculate repeatedly.

To gnu@gnu.org,
I would like to eventually contribute a couple more string enhancements,
but according to the pages at the FSF it mentions something about needing
a signature for enhancements beyond 20 lines of code.

----------  Forwarded Message  ----------
Subject: glibc suggested speed improvement to strcasestr.c
Date: Thursday 08 April 2004 01:49
From: Digital <Digital@JoesCat.com>
To: bug-glibc@gnu.org

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]