-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[stdlib] don't copy array contents on removeAll(keepingCapacity: true)
#39784
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
Conversation
|
@swift-ci please test |
|
Build failed |
|
@swift-ci please test |
|
@swift-ci please test Windows platform |
|
@swift-ci please test |
|
This does not solve the excessive copying problem when keeping a small number of items out an entire copied array, but it is a simple win. Solving the overall problem is much more involved. |
lorentey
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yay, thanks for fixing this! 🎉
Co-authored-by: Karoy Lorentey <[email protected]>
Co-authored-by: Karoy Lorentey <[email protected]>
|
Thanks for the suggestions @lorentey |
|
@swift-ci please test |
|
Note: I would still like to write a benchmark for this case and the "remove all elements but one" case. |
|
This change was made in #66085 |
When calling
Array.removeAll(keepingCapacity: true), bypass thereplaceSubrangecall unless the buffer is uniquely referenced.Resolves SR-13923 (rdar://71809690).