home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1900 < prev    next >
Internet Message Format  |  1990-12-28  |  889b

  1. From: markh@csd4.csd.uwm.edu (Mark William Hopkins)
  2. Newsgroups: alt.sources
  3. Subject: Re: Fast strcmp() wanted.
  4. Message-ID: <6757@uwm.edu>
  5. Date: 4 Oct 90 06:01:08 GMT
  6.  
  7. In article <12145@crdgw1.crd.ge.com> larocque@jupiter.crd.ge.com (David M. LaRocque) writes:
  8. >After I profiled my C program I discovered that the function
  9. >strcmp() takes one third of my program's CPU time.  I was hoping
  10. >someone may have written their own version of strcmp() that
  11. >outperforms the library's function.
  12.  
  13. Look at some references on the architecture of the machine your system is
  14. running on.  It will most likely have hardware-implemented string instructions
  15. that you can use.
  16.  
  17. On our machine, the strcmp library routine is really nothing more than a single
  18. assembly-language instruction with a couple register-initializations.  It will
  19. almost certainly run far faster than any equivalent high-level source.
  20.