Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!lll-lcc!pyramid!prls!mips!mash From: mash@mips.UUCP Newsgroups: comp.arch Subject: Re: String Processing Instruction Message-ID: <240@winchester.mips.UUCP> Date: Sun, 29-Mar-87 14:40:38 EST Article-I.D.: winchest.240 Posted: Sun Mar 29 14:40:38 1987 Date-Received: Tue, 31-Mar-87 01:08:24 EST References: <15292@amdcad.UUCP> <978@ames.UUCP> <909@spar.SPAR.SLB.COM> <236@winchester.mips.UUCP> <182@homxb.UUCP> Reply-To: mash@winchester.UUCP (John Mashey) Distribution: na Organization: MIPS Computer Systems, Sunnyvale, CA Lines: 30 In article <182@homxb.UUCP> gemini@homxb.UUCP (Rick Richardson) writes: >I got curious myself, and profiled "ls", "awk", "cpp", "lln", and >several SGS's and local applications programs for str* and mem* usage. >In most cases, the str* numbers were in the 0-3% range. Diff didn't >use strcat/cpy/cmp at all, though it obviously does lots of string work. >But I found heavy usage of the mem* routines in many of the newer programs >I tried. 7-20% was the range! > >If the C convention for strings had been length oriented, I suspect that >Dhrystone would come out with a better approximation of reality. This >would be due to the heavier usage of mem*-like routines for moving and >comparing the strings. My current sense of things says: a) strcmp finds a difference very quickly, and strlen sess fairly short strings, hence for them, it's most important to optimize the short cases. b) strcpy appears to copy longer strings than a), not as long as c). c) people use memcpy/bcopy for copying bigger hunks of memory, hence they need to be optimized for the long case: fortunately, since you have length as a parameter, you can make correct decisions easily, unlike the str* things, which must guess. There's one instance of bcopy that nees to be especially tuned for long copies, which is the one inside the kernel. None of the above is definitive, jsut the sort of patterns I've seen when I've looked. -- -john mashey DISCLAIMER: UUCP: {decvax,ucbvax,ihnp4}!decwrl!mips!mash, DDD: 408-720-1700, x253 USPS: MIPS Computer Systems, 930 E. Arques, Sunnyvale, CA 94086