-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Regex UpdateBumpalong optimization for non-atomic and lazy lo…
…ops (#63398) * Improve handling of UpdateBumpalong for non-atomic loops For atomic greedy loops, UpdateBumpalong is serving its purpose: upon consuming as much as possible for the loop, base.runtextpos is set to that position so that the next time FindFirstChar runs, it'll start from at least that location. However, for non-atomic greedy loops, with base.runtextpos being set to the ending position after each backtracking, we end up inadvertently voiding any benefits of the UpdateBumpalong, as we end up overwriting the further position with the shorter position. A simple tweak to that, only setting the position if it's greater, yields significant benefits, in particular when there's no match. * Add more tests for lazy loops These just duplicate the greedy loop tests and tweak them for lazy. * Insert UpdateBumpalong for lazy loops as well * Address PR feedback
- Loading branch information
1 parent
513fe28
commit 40047f2
Showing
5 changed files
with
167 additions
and
27 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.