Efficient STRing CoMPares?

Dan Bernstein brnstnd at kramden.acf.nyu.edu
Fri Mar 22 05:23:35 AEST 1991


In article <1151 at gistdev.gist.com> flint at gistdev.gist.com (Flint Pellett) writes:
> I'm curious if
> anyone has a method that actually speeds up strcmp() in the situtation
> where you have to get the lexicographic ordering information back.

Unrolling the loop produces good results on many machines. You can also
zoom through the strings comparing words, then compare characters if
necessary (i.e., when your byte order is backwards) to produce a result.
It works best if you know the string lengths beforehand and have each
string starting on a word boundary. Piercarlo can explain a lot more.

---Dan



More information about the Comp.lang.c mailing list