Path: utzoo!attcan!utgpu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!crdgw1!sixhub!davidsen From: davidsen@sixhub.UUCP (Wm E. Davidsen Jr) Newsgroups: alt.sources Subject: Re: Fast strcmp() wanted. Message-ID: <1966@sixhub.UUCP> Date: 29 Sep 90 20:55:31 GMT References: <1646@cherry.edc.UUCP> <1990Sep27.151543.8025@ccs.carleton.ca> Reply-To: davidsen@sixhub.UUCP (bill davidsen) Organization: *IX Public Access UNIX, Schenectady NY Lines: 15 In article <1990Sep27.151543.8025@ccs.carleton.ca> dfs@doe.carleton.ca (David F. Skoll) writes: | Hmm... that seems strange. If the first characters of the strings differ, | most strcmps will not bother to test the rest. All that the above code | possibly saves you is a function call/return. If this makes such a huge | difference, then the compiler or your machine's architecture must be pretty | bad. If the test of the first character saves a procedure call, then no matter how good the compiler is it will be faster not to do the call. -- bill davidsen - davidsen@sixhub.uucp (uunet!crdgw1!sixhub!davidsen) sysop *IX BBS and Public Access UNIX moderator of comp.binaries.ibm.pc and 80386 mailing list "Stupidity, like virtue, is its own reward" -me