-
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
Use SearchValues<string>
for prefix searching in RegexCompiler / source generator
#96402
Use SearchValues<string>
for prefix searching in RegexCompiler / source generator
#96402
Conversation
…urce generator We currently use IndexOf(literal), but every call to that incurs a little overhead to determine how best to do the search. Now that we have `SearchValues<string>`, even though it's bread-and-butter is searching for multiple substrings, we can use it to search for a single substring, in which case it's effectively the same as IndexOf(literal) but caching the result of that examination in order to only do it once rather than on every call. This also introduces some of the infrastructure necessary to subsequently enable multi-substring search.
Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions Issue DetailsWe currently use IndexOf(literal), but every call to that incurs a little overhead to determine how best to do the search. Now that we have This also introduces some of the infrastructure necessary to subsequently enable multi-substring search. Contributes to #85693
|
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.
Sweet
This may regress some cases with longer literals until we resolve #96142
We currently use IndexOf(literal), but every call to that incurs a little overhead to determine how best to do the search. Now that we have
SearchValues<string>
, even though it's bread-and-butter is searching for multiple substrings, we can use it to search for a single substring, in which case it's effectively the same as IndexOf(literal) but caching the result of that examination in order to only do it once rather than on every call.This also introduces some of the infrastructure necessary to subsequently enable multi-substring search.
Contributes to #85693