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

New dependency graph resolver has significant performance loss with RuntimeIdentifier #14180

Closed
brantburnett opened this issue Mar 13, 2025 · 3 comments
Assignees
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Bug

Comments

@brantburnett
Copy link

NuGet Product Used

dotnet.exe

Product Version

9.0.201

Worked before?

8

Impact

It's more difficult to complete my work

Repro Steps & Context

We have observed a very significant performance degradation for NuGet restore in .NET SDK 9 with the new dependency graph resolver. This is fixed for us by using <RestoreUseLegacyDependencyResolver>true</RestoreUseLegacyDependencyResolver>.

  • We are working with a very large repository with over 100 projects.
  • We use Microsoft.Build.Traversal to create a single dirs.proj file we can target to run the build.
  • We are using <RestoreUseStaticGraphEvaluation>true</RestoreUseStaticGraphEvaluation>; the speed is even worse without this enabled.
  • I don't think it's a factor, but we do use a private NuGet feed from GitHub Packages, package source mappings, ManagePackageVersionsCentrally, and CentralPackageTransitivePinningEnabled
  • The repository includes multiple executable projects with RuntimeIdentifier set.
  • We also have a "metaproject" that takes a ProjectReference dependency on the executable projects. This allows the executables and all dependencies to be collected into a single directory using a publish operation. This metaproject also has a RuntimeIdentifier set.

We recently noticed a notable increase in package restore time and began researching. The problem is particularly noticeable on slower GitHub Actions Windows build agents, but it is clearly apparent on developer machines as well. The metrics below are from a clean restore (cache filled but obj directories cleaned) on a developer machine.

Without metaproject With metaproject
Legacy Resolver 9.4s 12.3s
New Resolver 37.8s 184.2s

There is also some evidence in the logs that the projects that include a RuntimeIdentifer are the culprits. You can observe in the log snippet below from GitHub Actions that certain projects are much slower. These are the executable projects, except for DependencyHarvester, which is the metaproject.

Verbose Logs

Restored C:\a\Advantage\Advantage\src\api\Advantage.Service.Transactions\Advantage.Service.Transactions\Advantage.Service.Transactions.csproj (in 23 ms).
  Restored C:\a\Advantage\Advantage\src\api\Advantage.Service.Transactions\Advantage.Service.Transactions.UnitTests\Advantage.Service.Transactions.UnitTests.csproj (in 22 ms).
  Restored C:\a\Advantage\Advantage\src\api\Advantage.Service.TicketFormats\Advantage.Service.TicketFormats\Advantage.Service.TicketFormats.csproj (in 5 ms).
  Restored C:\a\Advantage\Advantage\src\api\Advantage.Service.ShiftDate\Advantage.Service.ShiftDate\Advantage.Service.ShiftDate.csproj (in 3 ms).
  Restored C:\a\Advantage\Advantage\src\apps\AdvantageTimeClockInOut\AdvClockInOut\AdvClockInOut.vbproj (in 3.7 sec).
  Restored C:\a\Advantage\Advantage\src\api\AdvantageApiServer\AdvantageApiServer\AdvantageApiServer.csproj (in 3.71 sec).
  Restored C:\a\Advantage\Advantage\src\apps\AdvantageSignageService\AdvSignageService\AdvSignageService.csproj (in 8.23 sec).
  Restored C:\a\Advantage\Advantage\src\apps\CECloud.Sync\CloudCommTest\CloudCommTest.csproj (in 38.33 sec).
  Restored C:\a\Advantage\Advantage\src\apps\CECloud.Sync\CECloud.Advantage.WindowsService\CECloud.Advantage.WindowsService.csproj (in 45.09 sec).
  Restored C:\a\Advantage\Advantage\src\setup\DependencyHarvester\DependencyHarvester.csproj (in 5.12 min).
@jeffkl jeffkl added Area:NewDependencyResolver Issues related to the new dependency graph resolver and removed Triage:Untriaged labels Mar 13, 2025
@jeffkl
Copy link
Contributor

jeffkl commented Mar 13, 2025

This is a duplicate of #14147 which is happening still because we are working on servicing .NET SDK 9.0.200. The fix is released in Visual Studio but only for non-SDK-style projects as well as nuget.exe.

@brantburnett
Copy link
Author

This is a duplicate of #14147 which is happening still because we are working on servicing .NET SDK 9.0.200. The fix is released in Visual Studio but only for non-SDK-style projects as well as nuget.exe.

Thanks for the info, I tried to find a duplicate before I filed but failed.

@jeffkl
Copy link
Contributor

jeffkl commented Mar 13, 2025

Not a problem, sorry you're experiencing this issue. The fix will be available in .NET SDK 9.0.200 which will be released on April 8th.

@jeffkl jeffkl self-assigned this Mar 13, 2025
@jeffkl jeffkl added the Resolution:Duplicate This issue appears to be a Duplicate of another issue label Mar 13, 2025
@jeffkl jeffkl closed this as completed Mar 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area:NewDependencyResolver Issues related to the new dependency graph resolver Resolution:Duplicate This issue appears to be a Duplicate of another issue Type:Bug
Projects
None yet
Development

No branches or pull requests

2 participants