Skip to content

Conversation

@glessard
Copy link
Contributor

When calling Array.removeAll(keepingCapacity: true), bypass the replaceSubrange call unless the buffer is uniquely referenced.

Resolves SR-13923 (rdar://71809690).

@glessard
Copy link
Contributor Author

@swift-ci please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 93d75c810bc4d72472bc8057e6d131b11e7f1609

@glessard
Copy link
Contributor Author

@swift-ci please test

@glessard
Copy link
Contributor Author

@swift-ci please test Windows platform

@glessard
Copy link
Contributor Author

@swift-ci please test

@glessard glessard marked this pull request as ready for review March 1, 2022 20:28
@glessard glessard requested a review from lorentey March 1, 2022 21:30
@glessard
Copy link
Contributor Author

glessard commented Mar 1, 2022

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.

Copy link
Member

@lorentey lorentey left a 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! 🎉

@glessard
Copy link
Contributor Author

glessard commented Mar 2, 2022

Thanks for the suggestions @lorentey

@glessard
Copy link
Contributor Author

glessard commented Mar 2, 2022

@swift-ci please test

@glessard
Copy link
Contributor Author

glessard commented Mar 3, 2022

Note: I would still like to write a benchmark for this case and the "remove all elements but one" case.

@glessard
Copy link
Contributor Author

This change was made in #66085

@glessard glessard closed this Aug 10, 2023
@glessard glessard deleted the sr13923 branch August 10, 2023 21:40
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.

3 participants