Skip to content
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

Use memcpy instead of std::copy #2249

Closed
wants to merge 1 commit into from
Closed

Conversation

atn34
Copy link
Collaborator

@atn34 atn34 commented Oct 16, 2019

This should give us a small performance gain once we use a glibc recent
enough that memcpy is faster than memmove

This should give us a small performance gain once we use a glibc recent
enough that memcpy is faster than memmove
@xumengpanda
Copy link
Contributor

I found in [1] that the performance of std::copy is not always worse than std::memcpy.

Do we still expect this to be merged?
If the recent compiler or arch. improvement can ensure memcpy is always better in performance, we may need some guard to choose between memcpy and std::copy based on the versions of compiler and arch.

[1] https://stackoverflow.com/questions/4707012/is-it-better-to-use-stdmemcpy-or-stdcopy-in-terms-to-performance

@atn34
Copy link
Collaborator Author

atn34 commented Dec 3, 2019

The reason memcpy can be faster is that std::copy needs to account for the ranges overlapping but memcpy doesn't. That said I think we can just close this for now, I don't think anyone is really bothered by this.

@atn34 atn34 closed this Dec 3, 2019
@atn34 atn34 deleted the use-memcpy branch December 3, 2019 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants