Skip to content
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> in Regex for single string searches #91644

Closed
stephentoub opened this issue Sep 5, 2023 · 2 comments
Closed

Use SearchValues<string> in Regex for single string searches #91644

stephentoub opened this issue Sep 5, 2023 · 2 comments

Comments

@stephentoub
Copy link
Member

#88400 updates regex to use SearchValues<string> for multi-substring search. But SearchValues<string> is also able to optimize single-substring search beyond what IndexOf(span, StringComparison.Ordinal{IgnoreCase}) does, as it can precompute and analyze more. We should update the Regex source generator (and possibly the RegexCompiler, although the equation for it is a bit different, as there's a little more overhead for the compiler to access a cached SearchValues<string>) to use SearchValues<string> for some of the places where it searches for a string, in particular the next-starting-position search.

@stephentoub stephentoub added this to the 9.0.0 milestone Sep 5, 2023
@ghost
Copy link

ghost commented Sep 5, 2023

Tagging subscribers to this area: @dotnet/area-system-text-regularexpressions
See info in area-owners.md if you want to be subscribed.

Issue Details

#88400 updates regex to use SearchValues<string> for multi-substring search. But SearchValues<string> is also able to optimize single-substring search beyond what IndexOf(span, StringComparison.Ordinal{IgnoreCase}) does, as it can precompute and analyze more. We should update the Regex source generator (and possibly the RegexCompiler, although the equation for it is a bit different, as there's a little more overhead for the compiler to access a cached SearchValues<string>) to use SearchValues<string> for some of the places where it searches for a string, in particular the next-starting-position search.

Author: stephentoub
Assignees: -
Labels:

area-System.Text.RegularExpressions, tenet-performance

Milestone: 9.0.0

@stephentoub
Copy link
Member Author

This is done

@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant