-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cache the return values for GetIdForErrorCode #31966
Conversation
src/Compilers/Core/Portable/Diagnostic/CommonMessageProvider.cs
Outdated
Show resolved
Hide resolved
473dc14
to
1b7f56c
Compare
Wouldn't an ImmutableDictionary + Interlocked operations be a better option than Concurrent Dictionary? I'm asking because this might regress from a lock contention perspective |
Assuming it lives up to its name, concurrent dictionary has a lock-free fast path 😄 |
Still, would be good to have profiling numbers. YMMV, but there's even allocation regressions from using a ConcurrentDictionary that could be more than the allocated strings we're seeing here. |
Unfortunately this came from a customer trace, so I don't have a clean way to reproduce it locally.
The trace that led to this showed over 125MiB of string allocations here. The only way to encounter this situation is for reads to overwhelmingly outnumber writes. |
@dotnet/roslyn-compiler for a second review here. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM Thanks (iteration 1)
@jaredpar for approval |
@sharwell This is approved to merge. |
Fixes #31964