Problem
parse_ipc_regex() is called separately in both _find_ipcs and parse_ipc_file, creating a new regex object each call. The regex only depends on $settings->ipc->prefix, which is effectively constant during a run.
Why This Matters
Minor but unnecessary overhead when scanning many IPC files; the regex should be computed once.
Suggested Fix
Cache the result in the object (e.g., $self->{+IPC_REGEX} //= $self->parse_ipc_regex()) and use the cached value in both call sites.
Details
|
|
| Severity |
🟢 Low |
| Category |
optimization |
| Location |
lib/App/Yath/IPC.pm:83, 138 |
| Effort |
⚡ Quick fix |
🤖 Created by Kōan from audit session
Problem
parse_ipc_regex()is called separately in both_find_ipcsandparse_ipc_file, creating a new regex object each call. The regex only depends on$settings->ipc->prefix, which is effectively constant during a run.Why This Matters
Minor but unnecessary overhead when scanning many IPC files; the regex should be computed once.
Suggested Fix
Cache the result in the object (e.g.,
$self->{+IPC_REGEX} //= $self->parse_ipc_regex()) and use the cached value in both call sites.Details
lib/App/Yath/IPC.pm:83, 138🤖 Created by Kōan from audit session