Skip to content

Optimization: Redundant regex recompilation in parse_ipc_file and _find_ipcs #335

@Koan-Bot

Description

@Koan-Bot

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions