Avoid unnecessarily resizing dictionary while calculating project closure #10976
Labels
Functionality:Restore
PerfWins
Priority:2
Issues for the current backlog.
Tenet:Performance
Performance issues
Type:Bug
Milestone
Thanks to @davkean for identifying a performance improvement in NuGet.
ToDictionary does not let you specify an underlying starting capacity. This causes it to inherit the default size and unnecessarily resize itself multiple times in a large solution. Added a version of ToDictionary that lets you specify a default.
https://github.com/davkean/NuGet.Client/blob/e97d556a83750bb4f8017e3640bc699d04832657/src/NuGet.Core/NuGet.ProjectModel/DependencyGraphSpec.cs#L191-L192
This was allocating 0.5% (150 MB) opening a 1000 project solution.
NuGet/NuGet.Client#4129 (comment)
The text was updated successfully, but these errors were encountered: