Skip to content

Provide optimized code path in check_regex_match function for non-regex strings#1466

Open
mgduda wants to merge 1 commit into
MPAS-Dev:developfrom
mgduda:framework/optimize_regex_match
Open

Provide optimized code path in check_regex_match function for non-regex strings#1466
mgduda wants to merge 1 commit into
MPAS-Dev:developfrom
mgduda:framework/optimize_regex_match

Conversation

@mgduda
Copy link
Copy Markdown
Contributor

@mgduda mgduda commented Jun 5, 2026

This PR provides an optimized code path in the check_regex_match function for non-regex 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.

Thanks to Yu-Tze Hong and Ying-Jhang Wu for identifying this opportunity for optimization and for providing the initial code changes.

…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.
@mgduda
Copy link
Copy Markdown
Contributor Author

mgduda commented Jun 5, 2026

The changes in this PR offer an alternative to those in PR #1456.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant