-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Reintroduce case sensitive comparison optimization for FrozenDictionary in some cases #95232
Reintroduce case sensitive comparison optimization for FrozenDictionary in some cases #95232
Conversation
Tagging subscribers to this area: @dotnet/area-system-collections Issue DetailsIn #94667 we fixed a bug where
This PR I am submitting re-introduces the optimization for scenarios like
I am not submitting any benchmarks up-front as it is a re-introduction of an optimization in some cases and there are no benchmarks for case insensitive Frozen Dictionaries. Please let me know if there's any relevant benchmarks I should run.
|
src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/String/KeyAnalyzer.cs
Outdated
Show resolved
Hide resolved
src/libraries/System.Collections.Immutable/src/System/Collections/Frozen/String/KeyAnalyzer.cs
Outdated
Show resolved
Hide resolved
@stephentoub I have addressed your comments. Thanks |
Is it worth adding benchmarks, you mention they don't exist? |
@danmoseley I would recommend that at least a few benchmarks are added to dotnet/performance with case insensitive comparison, yes. I can try to find the time to do so but I can not reliably make that commitment at this moment. |
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.
Thanks!
Sorry to pester but as it's approved, could it also be merged, please? |
In #94667 we fixed a bug where
FrozenDictionary<string, T>
was incorrectly using case sensitive comparison. The solution chosen minimized the diff as the PR would be ported to .NET 8. Upon reflection, alongside fixing the bug, it did de-optimize some cases where the optimization was in fact valid. The examples below give a quick summary.This PR I am submitting re-introduces the optimization for scenarios like
keys3
above i.e. where:KeyAnalyzer
has found a substringI am not submitting any benchmarks up-front as it is a re-introduction of an optimization in some cases and there are no benchmarks for case insensitive Frozen Dictionaries. Please let me know if there's any relevant benchmarks I should run.