Skip to content

Fix the atrocious performance of matching regexes after 9.16.0#84

Merged
allejo merged 2 commits into
9.18from
hotfix/regex-performance
Nov 22, 2020
Merged

Fix the atrocious performance of matching regexes after 9.16.0#84
allejo merged 2 commits into
9.18from
hotfix/regex-performance

Conversation

@allejo

@allejo allejo commented Nov 22, 2020

Copy link
Copy Markdown
Collaborator

In 9.16, I introduced the RegEx class in order to keep the PHP code aesthetically close to what the JS equivalent would be. However, the performance for RegEx was atrocious because instead of stopping after the first match, it continued moving on to find all of the matches (preg_match vs preg_match_all).

This PR fixes the atrocious performance but doesn't quite match the performance seen in 9.15 and below. I'm currently seeing 0.15 seconds with this PR where 9.15 had 0.09 seconds. The difference is... fairly negligible compared to the 40 second time currently in 9.18.

Fixes #78

@allejo allejo merged commit fa75a86 into 9.18 Nov 22, 2020
@allejo allejo deleted the hotfix/regex-performance branch November 22, 2020 06:07
@S1SYPHOS

Copy link
Copy Markdown
Collaborator

Glad you figured it out!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants