Skip to content

Remove locks on Style/TriggerBase counters, use atomic increments instead#10004

Open
h3xds1nz wants to merge 4 commits intodotnet:mainfrom
h3xds1nz:remove-counter-locks
Open

Remove locks on Style/TriggerBase counters, use atomic increments instead#10004
h3xds1nz wants to merge 4 commits intodotnet:mainfrom
h3xds1nz:remove-counter-locks

Conversation

@h3xds1nz
Copy link
Member

@h3xds1nz h3xds1nz commented Oct 26, 2024

Description

Similarly as in #9741, we will use simple Interlocked.Increment to retrieve the next globally unique index, instead of using a full-blown Monitor-type lock for such simple operation. This will contribute to startup performance mostly.

I've also removed IsEqual private static method in Style as it was just staring there at me, unused.

Customer Impact

Increased (mostly startup) performance.

Regression

No.

Testing

Local build.

Risk

Low, this is very easy to grasp.

Microsoft Reviewers: Open in CodeFlow

@h3xds1nz h3xds1nz requested review from a team as code owners October 26, 2024 22:12
@dotnet-policy-service dotnet-policy-service bot added PR metadata: Label to tag PRs, to facilitate with triage Community Contribution A label for all community Contributions labels Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Community Contribution A label for all community Contributions PR metadata: Label to tag PRs, to facilitate with triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant