-
Notifications
You must be signed in to change notification settings - Fork 696
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
Attempt to move several data structures to be immutable #5930
Conversation
src/NuGet.Core/NuGet.ProjectModel/PackageSpecReferenceDependencyProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If public APIs were not a consideration, this would be something very easy to accept.
We'll need to internally decide about the risk.
I did leave some feedback on the implementation.
Feel free to ping me offline you need any more clarifications.
src/NuGet.Core/NuGet.ProjectModel/CentralTransitiveDependencyGroup.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/PackageSpecReferenceDependencyProvider.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/TargetFrameworkInformation.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/TargetFrameworkInformation.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/TargetFrameworkInformation.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/TargetFrameworkInformation.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/TargetFrameworkInformation.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.Commands/Utility/AssetTargetFallbackUtility.cs
Outdated
Show resolved
Hide resolved
src/NuGet.Core/NuGet.Build.Tasks.Console/MSBuildStaticGraphRestore.cs
Outdated
Show resolved
Hide resolved
...uGet.CommandLine.XPlat/Commands/PackageReferenceCommands/AddPackageReferenceCommandRunner.cs
Show resolved
Hide resolved
src/NuGet.Core/NuGet.ProjectModel/CentralTransitiveDependencyGroup.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really have any feedback here.
This is a great change and something we've wanted to do for a while.
This should allow us to improve the no-op calculation eventually since we're primarily dealing with immutable objects (nearly all of them are I think).
We'll want to run some manual validation and get sign off as this is a binary breaking change.
There are ways we can reduce that footprint (by obsoleting certain method and using the new ones only), but some places, like the types becoming immutable there's simply not other way.
0fd3911
to
679d1af
Compare
Team Triage: Given the recent chnages in e68fb0f, we want to minimize the code churn in the restore area. We'd need to rebase closer to when we'd be ready for the next release. |
679d1af
to
3daa8d9
Compare
3daa8d9
to
262f923
Compare
src/NuGet.Core/NuGet.DependencyResolver.Core/Remote/RemoteDependencyWalker.cs
Outdated
Show resolved
Hide resolved
ebb3f9d
to
1b476ad
Compare
@NuGet/nuget-client This is ready for review. |
1b476ad
to
8c7e4e5
Compare
|
||
for (var i = 0; i < spec.Dependencies.Count; i++) | ||
{ | ||
// existingDependency.LibraryRange.VersionRange = range; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like old code (line 43) that was commented out during development, rather than an intentional comment. If it's an intentional comment, it needs improvement to be more understandable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, fixed now.
Bug
Fixes: NuGet/Home#13647
Reduces allocations during solution load in VS
Description
Modified several data structures to be immutable, such that the PackageSpec.Clone operation can allocate significantly less. The scenario is outlined in the bug, but it's essentially cutting a 2-3% of allocations of solution load from the solutions I've tested.
This change is a bit viral, and ended up being more involved than I had originally thought it would be, but it feels like this ends up not only being more performant, but also lends these data structures to be more sanely reasoned about.
*** before changes ***
*** with changes ***
PR Checklist