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 IndexOf for bounded loops in a regex code gen #101899

Merged
merged 1 commit into from
May 6, 2024

Conversation

stephentoub
Copy link
Member

Today with a pattern like ab*c, IndexOfAnyExcept('b') will be used to skip past the bs. But if that pattern is changed to ab{0, 1000}c, we'll end up manually iterating, as the current specialization only handles unbounded loops. This adds the minor improvements necessary to also enable using IndexOf for bounded loops.

Copy link
Contributor

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

Today with a pattern like `ab*c`, IndexOfAnyExcept('b') will be used to skip past the `b`s. But if that pattern is changed to `ab{0, 1000}c`, we'll end up manually iterating, as the current specialization only handles unbounded loops. This adds the minor improvements necessary to also enable using IndexOf for bounded loops.
@stephentoub stephentoub merged commit 08e0f89 into dotnet:main May 6, 2024
83 checks passed
@stephentoub stephentoub deleted the regexindexofbounded branch May 6, 2024 17:20
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
Today with a pattern like `ab*c`, IndexOfAnyExcept('b') will be used to skip past the `b`s. But if that pattern is changed to `ab{0, 1000}c`, we'll end up manually iterating, as the current specialization only handles unbounded loops. This adds the minor improvements necessary to also enable using IndexOf for bounded loops.
Ruihan-Yin pushed a commit to Ruihan-Yin/runtime that referenced this pull request May 30, 2024
Today with a pattern like `ab*c`, IndexOfAnyExcept('b') will be used to skip past the `b`s. But if that pattern is changed to `ab{0, 1000}c`, we'll end up manually iterating, as the current specialization only handles unbounded loops. This adds the minor improvements necessary to also enable using IndexOf for bounded loops.
@github-actions github-actions bot locked and limited conversation to collaborators Jun 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants