Reuse ProjectCachePlugin lookup state on cache miss
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
I've been experimenting with building an MSBuild accelerator using `ProjectCachePlugin`. I noticed that even a no-op plugin implementation that always returns `CacheMiss` and does no real work can still regress build time versus plain `dotnet build` by a noticeable amount. I'm seeing roughly **30-50%** in some runs, though I still need to gather more precise numbers.
One likely source is that MSBuild prepares project state for cache lookup before knowing whether the plugin will hit, then still performs a normal build on miss.
Current flow in `ProjectCacheService.PostCacheRequest`:
```text
EvaluateProjectIfNecessary(...)
-> LoadProjectIntoConfiguration(...)
-> configuration.Project.TranslateEntireState = true
new BuildRequestData(configuration.Project, targets)
GetCacheResultAsync(...)
```
If the plugin returns `CacheMiss`, the subsequent build should reuse this lookup-prepared project state and avoid any additional project load, translation, or transfer work beyond target execution.
Could MSBuild ensure that cache-lookup preparation fully substitutes for normal build preparation on `CacheMiss` / `CacheNotApplicable`?
Acceptance criteria: an all-miss no-op `ProjectCachePlugin` build should be close to the equivalent build without a cache plugin, aside from plugin callback/logging/scheduling overhead.
Related: #7112, #7121, #10615, #10616, #11490.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in ProjectCacheService.PostCacheRequest and trace EvaluateProjectIfNecessary, LoadProjectIntoConfiguration, and the BuildRequestData creation shown in the issue. Compare an all-miss ProjectCachePlugin build with an equivalent plain dotnet build; done means lookup preparation is reused on CacheMiss or CacheNotApplicable without extra project loading, translation, or transfer work beyond target execution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- build-system, performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100