-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Speed up single-value SearchValues<string> candidate verification #108365
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
Merged
MihaZupan
merged 8 commits into
dotnet:main
from
MihaZupan:searchvalues-singleStringLengths4
Mar 6, 2025
Merged
Speed up single-value SearchValues<string> candidate verification #108365
MihaZupan
merged 8 commits into
dotnet:main
from
MihaZupan:searchvalues-singleStringLengths4
Mar 6, 2025
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Tagging subscribers to this area: @dotnet/area-system-memory |
7051ac1 to
bc01b11
Compare
Contributor
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.
Copilot reviewed 5 out of 8 changed files in this pull request and generated 1 comment.
Files not reviewed (3)
- src/libraries/System.Private.CoreLib/src/System/Collections/Generic/RandomizedStringEqualityComparer.cs: Evaluated as low risk
- src/libraries/System.Private.CoreLib/src/System/String.cs: Evaluated as low risk
- src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs: Evaluated as low risk
...System.Private.CoreLib/src/System/SearchValues/Strings/SingleStringSearchValuesThreeChars.cs
Show resolved
Hide resolved
This was referenced Feb 8, 2025
stephentoub
reviewed
Feb 27, 2025
...s/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
Feb 27, 2025
...s/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs
Show resolved
Hide resolved
stephentoub
reviewed
Feb 27, 2025
...s/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs
Show resolved
Hide resolved
stephentoub
reviewed
Feb 27, 2025
...s/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs
Show resolved
Hide resolved
stephentoub
reviewed
Feb 27, 2025
...s/System.Private.CoreLib/src/System/SearchValues/Strings/Helpers/StringSearchValuesHelper.cs
Outdated
Show resolved
Hide resolved
stephentoub
reviewed
Feb 27, 2025
stephentoub
approved these changes
Feb 27, 2025
39e6787 to
fc28ebe
Compare
Member
Author
System.Text.RegularExpressions.Tests.Perf_Regex_Industry_RustLang_Sherlock
|
This was referenced Mar 11, 2025
Closed
Closed
This was referenced Mar 18, 2025
Closed
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR does 2 related changes to speed up the verification of potential matches:
[9, 16]chars.We already had groups
[2, 3] [4, 7] [8, ∞], this PR changes that to[2, 3] [4, 8] [9, 16] [17, ∞].SingleValueStatefor more details).These optimizations logically help more the more verifications we must perform.
As such it particularly helps with early matches, or where the anchor selection was poor such that we must rule out many false positives. In benchmarks like SliceSlice, it barely matters since matches are relatively rare.
It also gives us more options in the future to experiment with using fewer anchor characters (e.g. 2 instead of 3), trading higher scanning throughput for more false positive candidates, but where ruling those out is now cheaper.