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

Boxing of bool is to compute hashcode is causing excessive allocations #10917

Closed
jebriede opened this issue Jun 4, 2021 · 0 comments · Fixed by NuGet/NuGet.Client#4091
Closed
Assignees
Labels
Category:Quality Week Issues that should be considered for quality week Functionality:Restore PerfWins Tenet:Performance Performance issues Type:Bug

Comments

@jebriede
Copy link
Contributor

jebriede commented Jun 4, 2021

The HashCodeCombiner takes an object parameter in its AddObject method and when passed a bool, it boxes it as a Boolean object to then compute the hashcode. This allocates Boolean objects that are short-lived and not necessary.

Name                                                            	Inc %	           Inc
 Type System.Boolean                                            	  1.6	   123,456,256
+ clr!?                                                         	  1.6	   123,456,240
 + nuget.dependencyresolver.core!HashCodeCombiner.AddObject     	  0.8	    63,635,872
 + nuget.versioning!NuGet.Shared.HashCodeCombiner.AddObject(!!0)	  0.8	    59,820,380
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category:Quality Week Issues that should be considered for quality week Functionality:Restore PerfWins Tenet:Performance Performance issues Type:Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants