Skip to content

Conversation

@muellerj2
Copy link
Contributor

In ECMAScript mode (and in those cases where leftmost-longest mode behaves the same), the matcher returns the first encountered successful match. This means that _Match_pat() can be left immediately when a match is found, skipping the usual unwinding of the stack frames.

This should result in some slight performance improvements for ECMAScript regexes, as the matcher will do strictly less work. At least on my machine, though, any actual performance difference vanishes in the noise when I run the regex_search benchmark. That's why I don't provide any benchmark results.

But the main point of this change is that it is a prerequisite for further changes that will speed up matching by reducing the number of allocations the matcher performs.

@muellerj2 muellerj2 requested a review from a team as a code owner November 3, 2025 22:46
@github-project-automation github-project-automation bot moved this to Initial Review in STL Code Reviews Nov 3, 2025
@StephanTLavavej StephanTLavavej added enhancement Something can be improved regex meow is a substring of homeowner labels Nov 3, 2025
@StephanTLavavej StephanTLavavej moved this from Initial Review to Ready To Merge in STL Code Reviews Nov 3, 2025
@StephanTLavavej StephanTLavavej moved this from Ready To Merge to Merging in STL Code Reviews Nov 4, 2025
@StephanTLavavej
Copy link
Member

I'm mirroring this to the MSVC-internal repo - please notify me if any further changes are pushed.

@StephanTLavavej StephanTLavavej merged commit 67dbf14 into microsoft:main Nov 5, 2025
41 checks passed
@github-project-automation github-project-automation bot moved this from Merging to Done in STL Code Reviews Nov 5, 2025
@StephanTLavavej
Copy link
Member

Why go to all the effort of stack unwinding when we can flop over like a kitty and look adorable? 🐈 🐈‍⬛ 😻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Something can be improved regex meow is a substring of homeowner

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants