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

[Bug]: Boxing of structs to compute hashcode is causing excessive allocations #11866

Closed
wrall opened this issue Jun 11, 2022 · 1 comment · Fixed by NuGet/NuGet.Client#4666
Closed

Comments

@wrall
Copy link

wrall commented Jun 11, 2022

NuGet Product Used

Other/NA

Product Version

All

Worked before?

No response

Impact

Other

Repro Steps & Context

The HashCodeCombiner takes an object parameter in its AddObject method and when passed a value type such as a struct or enum value, it boxes it to do a null check and then compute the hashcode. This allocates boxed objects that are short-lived and not necessary.

After the fix for #11669, this becomes one of the top sources of allocation for NuGet restore for some scenarios.

image

image

Verbose Logs

No response

@wrall
Copy link
Author

wrall commented Jun 11, 2022

Note that a similar issue was handled in the past in #10917.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants