Newsgroups: comp.arch Path: utzoo!henry From: henry@utzoo.uucp (Henry Spencer) Subject: Re: RISC bashing at USENIX Message-ID: <1988Jul18.231543.19620@utzoo.uucp> Organization: U of Toronto Zoology References: <6965@ico.ISC.COM> <936@garth.UUCP> <202@baka.stan.UUCP> <1746@vaxb.calgary.UUCP> Date: Mon, 18 Jul 88 23:15:43 GMT In article <1746@vaxb.calgary.UUCP> radford@calgary.UUCP (Radford Neal) writes: >Your problem is that the above C code is grossly non-optimal. Assuming >that "count" is typically fairly large, the optimal C code is the >following: > > bcopy ((char*)src, (char*)dst, count*sizeof(long)); No. The optimal C code uses memcpy, not bcopy. The difference is not just six of one and half a dozen of the other: memcpy asserts that its operands do not overlap, and smart compilers can often generate better code with this knowledge. Also, memcpy is ANSI C and bcopy is just a Berkeleyism :-), so compilers are more likely to pay special attention (e.g. inlining) to memcpy. -- Anyone who buys Wisconsin cheese is| Henry Spencer at U of Toronto Zoology a traitor to mankind. --Pournelle |uunet!mnetor!utzoo! henry @zoo.toronto.edu