faster bcopy using duffs device
Karl Heuer
karl at haddock.ima.isc.com
Sat Sep 9 06:45:42 AEST 1989
In article <19473 at mimsy.UUCP> chris at mimsy.UUCP (Chris Torek) writes:
>bcopy() should be written in assembly (on most processors), put in
>a library, and forgotten about...
Yes. (And it should be called memcpy(), that being the standard name; of
course bcopy() can be an alternate synonym if it's done properly.) But if you
really want to blow the socks off the benchmarks, you should have the compiler
recognize memcpy() as a builtin. This not only allows it to be inlined, but
also makes possible certain compile-time optimizations such as constant length
move (for which unrolling might be a win) and known-alignment pointers (for
which it could safely copy larger-sized chunks).
Karl W. Z. Heuer (ima!haddock!karl or karl at haddock.isc.com), The Walking Lint
More information about the Comp.lang.c
mailing list