Mail Archives: djgpp/1997/12/21/07:11:38
On Sat, 20 Dec 1997, krizz wrote:
> i think memcpy is very slow.
I'd suggest to time the functions and look at their machine code as
produced by GCC (use the -S switch) before you decide to roll your own
version.
`memcpy' is actually very fast, *if* you compile with optimizations (-O2
switch to gcc). In many cases, it expands to inline assembly that uses
the same movesd instruction that you were trying to use in your code.
Even if it doesn't produce inline assembly, the code of `memcpy' itself
uses such a fast loop, so you only pay the overhead of a function call.
However, when you move buffers to the screen, your speed is limited by
the system bus and the performance of your SVGA. Most of the time, the
CPU is stalled while it waits for the bus and SVGA to do their thing.
- Raw text -