Provide optimized code path in check_regex_match function for non-regex strings#1466
Open
mgduda wants to merge 1 commit into
Open
Provide optimized code path in check_regex_match function for non-regex strings#1466mgduda wants to merge 1 commit into
mgduda wants to merge 1 commit into
Conversation
…ex strings When the 'pattern' argument to the check_regex_match function in regex_matching.c is not a regular expression, a simple string comparison is sufficient and the cost of compiling a regular expression can be avoided. This commit adds an optimized code path in the check_regex_match function for this case.
Contributor
Author
|
The changes in this PR offer an alternative to those in PR #1456. |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR provides an optimized code path in the
check_regex_matchfunction for non-regex strings. When thepatternargument to thecheck_regex_matchfunction inregex_matching.cis not a regular expression, a simple string comparison is sufficient and the cost of compiling a regular expression can be avoided.Thanks to Yu-Tze Hong and Ying-Jhang Wu for identifying this opportunity for optimization and for providing the initial code changes.