Fix lock contention in ProjectRootElementCache
Open
Area: Performance
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 141
Description
`Microsoft.Build.Evaluation.ProjectRootElementCache` is protected by a single `_locker` that is acquired by every read and every write. All evaluator threads in a single MSBuild process converge on this lock for every resolution, capping in-process evaluation parallelism regardless of available cores.
Symptoms: Profiling shows ~1,600+ contention events on _locker
`WeakValueDictionary` is not thread-safe, so every lookup requires the lock. `BoostEntryInStrongCache` is O(n) and runs under the lock on every cache hit.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.