What problem does it solve?
Optimizing Rust code without a disciplined process leads to unmeasurable changes, regressions, and wasted effort. This Skill provides a structured, repeatable loop for improving the performance of the syncpack-specifier crate: benchmark, identify bottlenecks, apply one change, verify tests, measure against baseline, and repeat.
Core Features & Use Cases
- Baseline Benchmarking: Saves criterion baselines with
cargo bench -p syncpack-specifier -- --save-baseline before so every change is measured against a known reference.
- Guided Bottleneck Analysis: Prioritizes the hot path (
Specifier::create, parser::is_range, parser::is_exact, regexes) and catalogs known optimization opportunities ranked by impact, such as replacing regexes with char-based parsing.
- Safe Iteration Discipline: Enforces one optimization per cycle, requires tests to pass before benchmarking, and mandates reverting regressions immediately.
- Use Case: A maintainer notices semver specifier parsing is slow in a large monorepo. The Skill runs the benchmark suite, finds that
is_range tries 12 regexes sequentially, replaces them with first-byte dispatch, verifies tests pass, and confirms a measurable percentage improvement against the baseline.
Quick Start
Run the optimize-benchmarks loop on the syncpack-specifier crate and report the before and after benchmark percentages for each accepted change.