Skip to content

perf(deps): regex recompiled on every call in summarize_cargo_str and summarize_requirements_str #2688

Description

@guyoron1

Bug

In src/cmds/system/deps.rs, three Regex::new() calls use static patterns but are compiled inside function bodies, causing recompilation on every invocation:

  • summarize_cargo_str(): dep_re (line 85-86) and section_re (line 87)
  • summarize_requirements_str(): dep_re (line 174)

Per project convention, static regex patterns must use lazy_static! to compile once at first use.

Impact

Unnecessary CPU overhead on every rtk deps call. The regex engine parses and compiles the same patterns repeatedly instead of caching the compiled automaton.

Fix

Move all three patterns to a lazy_static! block at module scope.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions