dotnet / dotnet/msbuild

Use EvaluationContexts in graph creation

Open
#7,002 2 comments 2 reactions 0 assignees View on GitHub
Area: Performance Area: Static Graph Partner request triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 6h
Merged PRs (30d)
139

Description

Discussed offline with @AArnott and @cdmihai.

When building the static graph, I/O can be a bottleneck for evaluating the many projects that get put into the graph. The existing `EvaluationContext` allows sharing filesystem enumerations and other operations and would potentially speed up evaluation (especially of heavily multitargeted solutions).

This may not be trivial (from @cdmihai):

> That’s a good point, static graph creation should use an evaluation context in order cache stuff from all the nodes’ evaluations, but it doesn’t. That would be one good perf optimization. Might be tricky to have it use an evaluation context because the graph builder provides a delegate to users, so the project evaluation happens in users’ code when they provide their own delegate. So we either change the delegate signature to receive an evaluation context (breaking change right?) or we change the ProjectCollection to carry an evaluation context (the delegate does receive a ProjectCollection).

Even if we can't make this fully generalizable, we should consider using an `EvaluationContext` for the default-behavior "don't specify your own delegate" case

```C#
using ProjectCollection projectCollection = new();
ProjectGraph graph = new(entrypoints, projectCollection);
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.