-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
replace memcpy with memmove #3937
Comments
Some useful benchmarks here on whether it is even worth figuring out whether |
I read those benchmarks as saying "just use loops." I know the author doesn't say that, but check out the curves: for all compilers except That confirms something I had noticed recently: on my current machine, with a current julia, I also couldn't see a difference. I found this interesting because some time ago I went to a certain amount of effort (#190) to incorporate If other people can't see any differences between for loops and |
I'd be wary of this if we don't know which change is the source of the speedup. I've seen (recently) order-of-magnitude differences in the speed of |
that trivial loop has the same bug I am advising against here. the use of loops in gcc is basically hoping that it's pattern matching algorithm will turn it into a call to memcpy (as shown in the blog). |
Fair enough. I agree it looks like the performance cost is negligible. |
Use memmove instead of memcpy in copy! Fixes #3937
@dcjones was that the only memcpy usage that needed to be switched? |
I looked at the memcpy ccalls in Base and this seemed like the only risky one. |
Uses of
memcpy
in Base may need to be replaced bymemmove
, except where we can guarantee that there is no pointer aliasing. (similarly, uses of LAPACK copy should be avoided, unless we first check for pointer aliasing)The text was updated successfully, but these errors were encountered: