dotnet / dotnet/msbuild

Optimize ReaderWriterLockSlim  allocations

Open
#14,769 0 comments 0 reactions 0 assignees View on GitHub
triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 13h
Merged PRs (30d)
133

Description

PR #12264 added a per-instance  `ReaderWriterLockSlim`  to  `PropertyDictionary`  to prevent concurrent modification during enumeration. Because  `PropertyDictionary`  is created frequently during evaluation and  `ProjectInstance`  construction, this adds a relatively large lock object to every instance.

In an OrchardCore design-time build,  `ReaderWriterLockSlim` account for approximately 71.84 MB of allocations across six MSBuild worker processes. Almost all are attributed to this per-instance allocation.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reviewing PR #12264 and tracing how PropertyDictionary is created during evaluation and ProjectInstance construction. Measure the per-instance ReaderWriterLockSlim allocations in a representative design-time build; done means reducing that allocation cost while preserving safe concurrent enumeration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
build-system, performance
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.