faster alternative to memcpy?

Tony Stark picture Tony Stark · Jun 3, 2010 · Viewed 83.8k times · Source

I have a function that is doing memcpy, but it's taking up an enormous amount of cycles. Is there a faster alternative/approach than using memcpy to move a piece of memory?

Answer

nos picture nos · Jun 3, 2010

memcpy is likely to be the fastest way you can copy bytes around in memory. If you need something faster - try figuring out a way of not copying things around, e.g. swap pointers only, not the data itself.