Path: utzoo!utgpu!cs.utexas.edu!wuarchive!uunet!mcsun!ukc!axion!edc!fraser 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 References: <12145@crdgw1.crd.ge.com> Reply-To: fraser@cherry.UUCP (Fraser Orr) Organization: Atex European Development Centre, Livingston, Scotland Lines: 20 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 +44 506 416778x206 UseNet: {uunet,sun}!atexnet!fraser JANet: fraser%edc@cs.hw.ac.uk