home *** CD-ROM | disk | FTP | other *** search
- From: fraser@edc.UUCP (Fraser Orr)
- Newsgroups: alt.sources
- Subject: Re: Fast strcmp() wanted.
- Message-ID: <1646@cherry.edc.UUCP>
- Date: 26 Sep 90 16:26:26 GMT
-
- In article <12145@crdgw1.crd.ge.com> larocque@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.
-
- One quick dirty thing I did once was to change
-
- if (strcmp (a,b)==0)
- to
- if (*a==*b && (strcmp(a.b)==0))
-
- I seem to remember a remarkable performance improvement, like about 5
- times faster. Probably due to the fact that the program mainly did
- strcmp and the strcmp was pretty bad.
-
- Worth considering anyway.
-
- ==Fraser Orr <fraser@edc.uucp> +44 506 416778x206
- UseNet: {uunet,sun}!atexnet!fraser JANet: fraser%edc@cs.hw.ac.uk
-