bcopy

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Tue Dec 13 00:52:00 AEST 1988



>don't let the twerps responsible for the memcpy/memmove debacle blind
>implementers. memcpy and memmove should be the same entry point;
>the test for overlapping regions is only a few instructions and just doesn't
>matter in any practical timing sense. If the bytecount is at all significant,
>initial overhead is irrelevent and if teh bytecount is small, then the
>subroutine call overhead is probably 2-3 times more expensive than the
>check.
>	in any case, in a lot of hardware, overlapping doesn't matter;
>what matters is left to right or right to left.
>	does anyone know of any case where the above analysis fails?

memmove and memcpy should NOT be the same entry point. On most
computers they shouldn't HAVE entry points - they should be inline.
On sufficiently CISC cpu's they should be single instructions
if the arguments are constants. If not, they should still be very small.
It seems to me the idea is that memcpy should be the most efficient
possible way to copy SMALL things - maybe even things like structs
containing four bytes, in which case a 32 bit integer move instruction
could be generated (if the alignemnt was right). When ANSI becomes
standard, there will be standard benchmarks that cruelly penalize
compilers with slow memcpy and memmoves.



More information about the Comp.unix.questions mailing list