Skip to content

Feature/regex match speedup#1456

Open
yjwu890355 wants to merge 1 commit into
MPAS-Dev:developfrom
CWA-NWP:feature/regex_match_speedup
Open

Feature/regex match speedup#1456
yjwu890355 wants to merge 1 commit into
MPAS-Dev:developfrom
CWA-NWP:feature/regex_match_speedup

Conversation

@yjwu890355
Copy link
Copy Markdown

Speed up regex matching in diagnostic output

Compile the diagnostic output regex pattern once and reuse it across all stream
name checks instead of calling regcomp() for every comparison. This avoids
repeated regex compilation overhead in regex_matching.c, which could account for
more than 30% of execution time.

Timer information shows 10x speedup in 'diagnostic_fields' on CWA Fujitsu FX1000 machine

Credit: Yu-Tze Hong aspen.hong@gmail.com

Compile the diagnostic output regex pattern once and reuse it across all stream
name checks instead of calling regcomp() for every comparison. This avoids
repeated regex compilation overhead in regex_matching.c, which could account for
more than 30% of execution time.

Timer information shows 10x speedup in 'diagnostic_fields' on CWA Fujitsu FX1000 machine

Credit: Yu-Tze Hong <aspen.hong@gmail.com>
@yjwu890355 yjwu890355 changed the base branch from release-v8.4.0 to master May 19, 2026 09:09
@mgduda mgduda changed the base branch from master to develop May 19, 2026 20:33
@mgduda mgduda self-requested a review May 19, 2026 20:34
@mgduda
Copy link
Copy Markdown
Contributor

mgduda commented May 20, 2026

@yjwu890355 Thank you for identifying this opportunity to speed up regular expression matching. Under the assumption that most calls to the check_regex_match function will not be using a regular expression, but will instead be checking a simple non-regex string, I think the changes in this commit would offer similar speed-ups but with far less code: ae7a389 .

Would you be willing to consider the code changes in commit ae7a389 instead?

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.

2 participants