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

Shared EvaluationContext for graph construction #9680

Merged
merged 6 commits into from Apr 24, 2024

Conversation

rainersigwald
Copy link
Member

Fix #9678 by creating a single shared EvaluationContext in the Graph object and using it when creating ProjectInstances using the default factory.

This is similar to how NuGet static-graph restore already works: https://github.com/NuGet/NuGet.Client/blob/b83566ec2369c4e9fd07e6f95d734dfe370a1e66/src/NuGet.Core/NuGet.Build.Tasks.Console/MSBuildStaticGraphRestore.cs#L885

Since we're evaluating the projects in the graph in parallel and "all at once", the shared caches in the EvaluationContext should be a solid improvement.

Fix dotnet#9678 by creating a single shared `EvaluationContext` in the `Graph`
object and using it when creating `ProjectInstance`s using the default
factory.

This is similar to how NuGet static-graph restore already works: https://github.com/NuGet/NuGet.Client/blob/b83566ec2369c4e9fd07e6f95d734dfe370a1e66/src/NuGet.Core/NuGet.Build.Tasks.Console/MSBuildStaticGraphRestore.cs#L885

Since we're evaluating the projects in the graph in parallel and "all at
once", the shared caches in the `EvaluationContext` should be a solid
improvement.
@rokonec rokonec self-assigned this Jan 30, 2024
Copy link
Contributor

@rokonec rokonec left a comment

Choose a reason for hiding this comment

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

Nice job. Have you measured it? If not I can do that on VCProj, would be nice to know.

@rainersigwald
Copy link
Member Author

Nice job. Have you measured it? If not I can do that on VCProj, would be nice to know.

Do you remember what you were thinking of about VCProj? Was it for building the graph that part of the VS repo? If so this won't help: those scenarios already had good SDK resolution caching; it's the simple API calls like new ProjectGraph(project) that this will help.

@rainersigwald rainersigwald merged commit 47ba51c into dotnet:main Apr 24, 2024
10 checks passed
@rainersigwald rainersigwald deleted the exp/context-for-graph branch April 24, 2024 18:46
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.

Static graph construction does not use a shared evaluation context
4 participants