Faster than memcpy()...
-
Has anyone here ever had the need to use something faster than memcpy() to move a large amount of data in physcal memory? I have a suspicion that memcpy is copying only a few bytes at a time, depending on what compiler is used. Any information floating around here? (I'm also googling, and I'll update this thread if I find something..)
-
Has anyone here ever had the need to use something faster than memcpy() to move a large amount of data in physcal memory? I have a suspicion that memcpy is copying only a few bytes at a time, depending on what compiler is used. Any information floating around here? (I'm also googling, and I'll update this thread if I find something..)
I certainly agree that the performance of memcpy is dependent on the compiler. I took a quick look at the memcpy that came with my version of Visual C++ and it looks well written. That is, it should run fast for large data blocks. You wrote that memcpy only copies a few bytes at a time. The code I saw was using a block move instructions to do most of the work. However, we may not be looking at the same code. Which compiler are you using? Bob
-
I certainly agree that the performance of memcpy is dependent on the compiler. I took a quick look at the memcpy that came with my version of Visual C++ and it looks well written. That is, it should run fast for large data blocks. You wrote that memcpy only copies a few bytes at a time. The code I saw was using a block move instructions to do most of the work. However, we may not be looking at the same code. Which compiler are you using? Bob
VS 2005 - memcpy.c
while (count--) { \*(char \*)dst = \*(char \*)src; dst = (char \*)dst + 1; src = (char \*)src + 1; }
definitely not a block copy. Which version do you have and can you post the relevant code?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
Has anyone here ever had the need to use something faster than memcpy() to move a large amount of data in physcal memory? I have a suspicion that memcpy is copying only a few bytes at a time, depending on what compiler is used. Any information floating around here? (I'm also googling, and I'll update this thread if I find something..)
With VS your release build will likely use the intrinsic version. http://msdn.microsoft.com/en-us/library/26td21ds(VS.80).aspx[^]
...cmk The idea that I can be presented with a problem, set out to logically solve it with the tools at hand, and wind up with a program that could not be legally used because someone else followed the same logical steps some years ago and filed for a patent on it is horrifying. - John Carmack
-
VS 2005 - memcpy.c
while (count--) { \*(char \*)dst = \*(char \*)src; dst = (char \*)dst + 1; src = (char \*)src + 1; }
definitely not a block copy. Which version do you have and can you post the relevant code?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
VS 2005 - memcpy.c
while (count--) { \*(char \*)dst = \*(char \*)src; dst = (char \*)dst + 1; src = (char \*)src + 1; }
definitely not a block copy. Which version do you have and can you post the relevant code?
You may be right I may be crazy -- Billy Joel -- Within you lies the power for good - Use it!
-
I have VS 2008, version 3.5. I believe that this code is copy righted so, I cannot post it. Sorry. Bob Sherry