-
-
Notifications
You must be signed in to change notification settings - Fork 187
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
Optimize regular expressions #674
Comments
I'm removing the v2.1 milestone as I've already tested a number of expressions and am fairly happy with the current state of things. However, I'll keep this open in case any regex experts want to dig deeper and maybe find something that I missed. |
regexes with lots of alternations could be optimized like the one I link to commonmark/src/Util/RegexHelper.php Line 44 in 42781fd
several alternations could be reduced by combining similar ones into optional atomic groups, but readability and maintainability go down the toilet and break the sewers. However, I cannot find where that specific regex is used. |
This library makes heavy use of regular expressions. While most of them should be fairly performant, there could certainly be some room for improvement to help improve the performance of this library. Examples of improvements might include:
Tools that could help here include:
A partial list of areas where regex is used in this library include:
BlockStartParserInterface::tryStart()
BlockContinueParserInterface::tryContinue()
InlineParserInterface::parse()
InlineParserMatch
builds regular expressions, which are then used byInlineParser
I will accept (almost) any PR that aims to improve performance, though I would ask that you keep the following in mind:
The text was updated successfully, but these errors were encountered: