fix: cache compiled regex in parse_ipc_regex#361
Open
Koan-Bot wants to merge 1 commit intoTest-More:2.0from
Open
fix: cache compiled regex in parse_ipc_regex#361Koan-Bot wants to merge 1 commit intoTest-More:2.0from
Koan-Bot wants to merge 1 commit intoTest-More:2.0from
Conversation
…pilation
`parse_ipc_regex()` was called independently in both `_find_ipcs` and
`parse_ipc_file`, creating a new regex object on each call. Since the
regex only depends on `$settings->ipc->prefix` which is constant during
a run, cache the result in `$self->{+IPC_REGEX}` so it is compiled once
and reused.
Fixes Test-More#335
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Collaborator
|
@exodist ready to review |
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.
Summary
parse_ipc_regex()was called separately in both_find_ipcsandparse_ipc_file, creating a new regex object on every call. Since the regex only depends on$settings->ipc->prefixwhich is constant during a run, the result is now cached in$self->{+IPC_REGEX}and reused on subsequent calls.Fixes #335
Changes
+ipc_regexto the HashBase attribute list inApp::Yath::IPCparse_ipc_regex()to cache and return$self->{+IPC_REGEX}after the first compilationparse_ipc_regex()return the same cached objectTest plan
parse_ipc_regex() caches the compiled regexint/unit/App/Yath/IPC.tverifies the returned regex is the same object on repeated callsGenerated by Kōan /fix
Quality Report
Changes: 1364 files changed, 102466 insertions(+), 24695 deletions(-)
Code scan: 224 issue(s) found
.gitignore:40— TODO commentREADME:607— TODO commentREADME:611— TODO commentREADME:615— TODO commentREADME.md:565— TODO commentREADME.md:569— TODO commentREADME.md:573— TODO commentdemo/tiny/tiny.t:4— XXX markerdeplib/App/Yath/Option.pm:21— FIXME commentdeplib/App/Yath/Options.pm:22— FIXME commentTests: failed (timeout (120s))
Branch hygiene: clean
Generated by Kōan post-mission quality pipeline