Fast strcmp() wanted.

Mark William Hopkins markh at csd4.csd.uwm.edu
Thu Oct 4 16:01:08 AEST 1990


In article <12145 at crdgw1.crd.ge.com> larocque at jupiter.crd.ge.com (David M. LaRocque) writes:
>After I profiled my C program I discovered that the function
>strcmp() takes one third of my program's CPU time.  I was hoping
>someone may have written their own version of strcmp() that
>outperforms the library's function.

Look at some references on the architecture of the machine your system is
running on.  It will most likely have hardware-implemented string instructions
that you can use.

On our machine, the strcmp library routine is really nothing more than a single
assembly-language instruction with a couple register-initializations.  It will
almost certainly run far faster than any equivalent high-level source.



More information about the Alt.sources mailing list