Closed engvall closed 9 years ago
What compiler and flags are you using? Interestingly, both forward and reverse Copy compiles to a memcpy
call using gcc-4.9 and -O3 -march=native
.
I'm using gcc 4.2.1 with flags -O3 and -march=native. Am I understanding correctly that if I compiled with gcc-4.9, I wouldn't see the marked change in performance for the Copy test?
I see it at -O3
, but not at -O2
. But if both are calling memcpy
, we're not testing forward and reverse traversal. There was a time where reverse memcpy
was faster than forward for sizes that fit in cache. This broke Flash and a few other buggy programs.
http://lwn.net/Articles/414467/ https://sourceware.org/bugzilla/show_bug.cgi?id=12518
I don't have too much experience with assembly, but it doesn't look like its calling memcpy (using version 4.2.1)
Tested the effects of reverse access to memory on both an i5 and i7 processor.