-
Notifications
You must be signed in to change notification settings - Fork 2.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
Fix copy_str performance #2475
Fix copy_str performance #2475
Conversation
|
Also |
Also |
@vitaut Why close PR without solving the problem and waiting for an answer? I wrote a great working implementation in which optimizations not only work but are also applicable in large cases. (See code) |
@foonathan also like copy_str (which depends on std::is_constant_evaluated ()) |
Please explain in more detail what problem you are trying to solve. |
@vitaut Example:
What overload will be caused by the result? Obviously the first, but we want the second |
The best way I can think of to fix this behavior is
This works great for pointer iterators (we need separate body movements for wrappers, but that's enough for us) |
Why it's obvious? https://godbolt.org/z/PPx3rve9h |
Just call you in different ways. |
Ok, so here is the updated usage with
from examples without properly adapting it. |
But can we reopen this PR, since the second one is wrong because of incorrect |
I can reopen this PR but this would require closing the other one to make github happy. |
Since this PR cannot be reopen because of a force-push, please move the discussion to #2477. |
Contrary to expectations, optimized overloading is not called. std::copy is perfectly optimized in std::memmove (like std::uninitialized_copy_n, and other analogs that are used in the project) and in many more cases than this implementation suggests