• Welcome to Valhalla Legends Archive.
 

Performance of memcpy() vs CopyMemory

Started by Dyndrilliac, July 11, 2005, 02:37 PM

Previous topic - Next topic

Dyndrilliac

I was told that using memcpy from string.h is faster than CopyMemory from windows.h. Is this true?
Quote from: Edsger W. DijkstraIt is practically impossible to teach good programming to students that have had a prior exposure to BASIC; as potential programmers they are mentally mutilated beyond hope of regeneration.

R.a.B.B.i.T

memcpy() is in windows.h (or stdlib.h, I forget which).  Unless you're doing something which would require absolute speed (like calculating intercept vectors for missiles), it really doesn't matter.

Adron

When you use memcpy it will typically be inlined and optimized by the compiler, while CopyMemory might not be. That's a possible explanation for a performance difference between them.