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

TargetEntry optimizations for Results #9590

Merged
merged 4 commits into from
Feb 1, 2024

Conversation

Forgind
Copy link
Member

@Forgind Forgind commented Jan 4, 2024

Context

@jeffkl has a case with potentially thousands of items that would all go into one bucket in the Returns. MSBuild is deduplicating it, but so is NuGet, which is wasteful, so he will likely stop using Returns. This change will save him a small amount of allocations, but it would save a ton of allocations if he were to keep using it, since it will no longer need to repeatedly reallocate the HashSet, and it won't need to allocate as many Lists. It will still save one List's worth of allocations on every single Target that doesn't have a Returns.

Changes Made

Effectively making List allocations lazier and taking advantage of ToList to avoid doing as many (duplicated) collection operations.

Co-authored-by: Jeff Kluge <jeffkl@microsoft.com>
@rokonec rokonec assigned Forgind and unassigned rokonec Jan 31, 2024
@Forgind Forgind merged commit 07fd5d5 into dotnet:main Feb 1, 2024
8 checks passed
@Forgind Forgind deleted the targetResults-optimizations branch February 1, 2024 00: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.

4 participants