faster bcopy using duffs device (source)

Walter Bright bright at Data-IO.COM
Tue Sep 12 04:05:28 AEST 1989


In article <5603 at thor.acc.stolaf.edu> mike at thor.stolaf.edu () writes:
<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
<I just tried the obvious bcopy "while (n--) *s++ = *d++;"
<on a 68010 using gcc.  It produced a dbra loop that beat
<the sh*t out of the supposedly carefully handcoded one
<in the C library.

Why not contribute your improved version to GNU? That way, *users* of GNU
C will get the advantage of your faster code, instead of just netters.
If the compiler library benefits from successive waves of programmers
improving on it, eventually it will get to the point where it can be
just used with the confidence that it's the best it can be.



More information about the Comp.lang.c mailing list