News for hackers. Stuff that matters.
Re:Memcpy vs. memmove by jandrese on Monday December 01, 2014 @03:42PM (#8683636)
It's fun to benchmark memmove and memcpy on a box to see if memcpy has more optimizations or not. On Linux x86_64 gcc memcpy is usually twice as fast when you're not bound by cache misses, while both are roughly the same on FreeBSD x86_64 gcc.

Linux (2.4Ghz Xeon X3430):

./memtest 10000 1000000

memcpy took 0.575571 seconds

memmove took 1.082038 seconds

FreeBSD (2.0Ghz AMD Athlon64 3000):

./memtest 10000 1000000

memcpy took 1.487334 seconds

memmove took 1.442741 seconds

Re:Memcpy vs. memmove by TrainedMonkey on Monday December 01, 2014 @04:06PM (#8683795)
I am sure that different memory controllers and CPU specific of optimizations of Intel vs AMD play a small role as well.
Re:Memcpy vs. memmove by lbenes on Monday December 01, 2014 @08:57PM (#8685269)
Re:Memcpy vs. memmove by jandrese on Tuesday December 02, 2014 @05:13PM (#8690334)
It's one I wrote myself to test this very thing after reading the memmove manpage. I was wondering why you would ever use memcpy unless it had a big performance advantage, so I wrote a micro-benchmark to see. If you are really interested, I can put my benchmark program up somewhere.

Additional findings: Unsurprisingly using clang instead of gcc does not affect performance on FreeBSD or Linux.

Re:Memcpy vs. memmove by lbenes on Wednesday December 03, 2014 @02:12PM (#8695735)
Yes please. If you want share it, I'm curious how different compilers and architectures handle memmove vs memcpy.