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

Optimize away separate evaluation for /restore when the restore didn't actually pull down new props/targets #2677

Closed
nguerrera opened this issue Oct 26, 2017 · 7 comments

Comments

@nguerrera
Copy link
Contributor

nguerrera commented Oct 26, 2017

We're moving the CLI's implicit restore over to using /restore. I was describing to @DustinCampbell how this will eliminate the need for two processes, but not the need for two evaluations. He pointed out that we don't always need two evaluations.

Common cases:

  • No nuget packages are referenced that pull in props/targets
  • Restore was incremental and did change the props/targets that were pulled down previously

Perhaps the Restore target could return a value to indicate whether or not it invalidated the evaluation. If it indicates that no props/targets have changed, then we could reuse the same evaluation for build...

cc @emgarten @jeffkl @AndyGerlicher @davkean

@davkean
Copy link
Member

davkean commented Oct 26, 2017

This is a damn good idea. This would immediately save 400ms in our no-changes restore cli build.

//cc @jainaashish

@emgarten
Copy link
Member

It should be possible to find the last modified date of .nuget.g.props and .nuget.g.targets before restore and compare it to the modified date after restore. If they are the same then there haven't been any changes.

Restore checks that something actually changed before modifying the props/targets. These files should also always exist, if they aren't there then the project is in a bad state.

@davkean
Copy link
Member

davkean commented Oct 30, 2017

To do that we need to evaluate and know about stuff that only NuGet should know about. I'd prefer the restore target returning something.

@emgarten
Copy link
Member

@davkean that makes sense. Restore could return a RestoreResult item with metadata for the props/targets change status.

I've opened NuGet/Home#6122 to track the work for adding this to restore.

@ghost
Copy link

ghost commented Dec 31, 2017

Seems like fix is pending review from MSBuild team: NuGet/NuGet.Client#1831.

@nkolev92
Copy link

nkolev92 commented Jan 4, 2018

This can be closed now as it will not bring us the initially expected benefit, due to the fact that restore evaluation is with ExcludeRestorePackageImports=true.

For OrchardCore:

/t:build /restore
Time Elapsed 00:00:57.75
Time Elapsed 00:00:58.31

/t:restore,build
Time Elapsed 00:00:57.81
Time Elapsed 00:00:58.82

@davkean
Copy link
Member

davkean commented May 16, 2018

Agreed. @nguerrera?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants