Make Remove-all-items O(1)#5350
Merged
Merged
Conversation
benvillalobos
approved these changes
May 12, 2020
cdmihai
reviewed
May 13, 2020
cdmihai
approved these changes
May 13, 2020
Contributor
There was a problem hiding this comment.
LGTM. Make sure this PR does not close #2314, since the issue has multiple bullets with more potential perf optimizations. I am actually surprised nobody measurably ran into the perf issue that would require the dictionary lookup optimization
I want to use this in another subclass.
6db3fe3 to
4459ab7
Compare
ladipro
reviewed
May 15, 2020
Member
There was a problem hiding this comment.
nit:
Suggested change
| listBuilder.RemoveAll((_) => true); | |
| listBuilder.Clear(); |
Member
Author
There was a problem hiding this comment.
🤦♂️ I swear I used and/or looked for this before. Thanks!
In the special case where a remove operation removes all items like
```xml
<Compile Remove="@(Compile)" />
```
We currently have poor behavior because we match ("everything matches")
and then remove items one at a time. Instead, we can just empty out the
list.
Part of dotnet#2314.
4459ab7 to
811b648
Compare
3 tasks
Forgind
added a commit
that referenced
this pull request
Dec 3, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
In the special case where a remove operation removes all items like
We currently have poor behavior because we match ("everything matches")
and then remove items one at a time. Instead, we can just empty out the
list.
Fixes #2314. Encouraged to finally do this by @maartenba's blog post https://blog.jetbrains.com/dotnet/2020/05/11/story-csproj-large-solutions-memory-usage/.