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

Improve NuGet.targets restore perf #1214

Closed
wants to merge 1 commit into from
Closed

Conversation

emgarten
Copy link
Member

@emgarten emgarten commented Mar 1, 2017

Walk project to project references first while creating a minimum number of items to track the full closure of projects. Removing duplicates along the way is important for perf reasons, if too many items are created restore will grind to a halt as they build.

Once all projects have been found create specs for the projects directly instead of creating them during the walk. This also helps to keep the number of items down.

Performance improvement on a project with 127 projects with a maximum number of project references between them.
Before: 900 seconds
After: 21 seconds

In addition to the perf changes this also adds in the full set of dotnet cli tool references when recursive is set. Getting this information is much easier now that the full set of projects is found up front.

Single() -> First() changes in the tests are due to changes to the SDK. These tests fail to for me, but work fine on the CI today which uses an older build.

Fixes NuGet/Home#4592
Fixes NuGet/Home#4711

Walk project to project references first while creating a minimum number of items to track the full closure of projects. Removing duplicates along the way is important for perf reasons, if too many items are created restore will grind to a halt as they build.

Once all projects have been found create specs for the projects directly instead of creating them during the walk. This also helps to keep the number of items down.

Performance improvement on a project with 127 projects with a maximum number of project references between them.
Before: 900 seconds
After: 21 seconds

In addition to the perf changes this also adds in the full set of dotnet cli tool references when recursive is set. Getting this information is much easier now that the full set of projects is found up front.

Fixes NuGet/Home#4592
Fixes NuGet/Home#4711
@@ -47,6 +47,10 @@ public override bool Execute()

var entries = new List<ITaskItem>();

// Filter obvious duplicates without considering OS case sensitivity.
// This will be filtered further when creating the spec.
var seen = new HashSet<string>(StringComparer.Ordinal);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why? why can't we use the right comparer based on OS here as well?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It could use that check, but I think this is better handled at a higher level when creating the dg file. This part is just a helper in MSBuild that creates items with extra metadata.

@emgarten emgarten closed this Mar 2, 2017
@emgarten emgarten deleted the dev-emgarten-targetsPerf2 branch March 2, 2017 01:51
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.

3 participants