Agent skill
bench-compare
Run Criterion benchmarks with baseline comparison for performance optimization work
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/bench-compare-ahrav-scratch-scanner-rs-2
SKILL.md
Benchmark Comparison Workflow
Compare benchmark results against a baseline to measure optimization impact.
Usage
Invoke with optional benchmark filter:
bench-compare- Run all benchmarksbench-compare scan- Run only scan-related benchmarksbench-compare throughput- Run throughput benchmarks
Workflow
1. Establish Baseline
Before making changes, save current benchmark results:
cargo bench --bench <name> -- --save-baseline before
Or for all benchmarks:
cargo bench -- --save-baseline before
2. Apply Changes
Make the optimization changes to the codebase.
3. Compare Results
Run benchmarks against the saved baseline:
cargo bench --bench <name> -- --baseline before
4. Analyze Output
Look for these patterns in Criterion output:
Performance has improved- Optimization successfulPerformance has regressed- Changes hurt performanceNo change in performance- Within noise threshold
5. Report Summary
Provide a summary table:
| Benchmark | Before | After | Change |
|---|---|---|---|
| name | X ns | Y ns | -Z% |
Available Benchmarks
The project has these benchmark files in benches/:
scan.rs- Core scanning performancescanner_throughput.rs- End-to-end throughputvectorscan_overhead.rs- Vectorscan integration overheadrule_isolation.rs- Per-rule cost isolationhotspots.rs- Known hot path benchmarks (requiresbenchfeature)validator.rs- Validation step benchmarks (requiresbenchfeature)- Data structure benchmarks:
ring_buffer,fixed_set,fixed_vec,timing_wheel, etc.
Tips
- Use
--bench <name>to run specific benchmarks for faster iteration - The
hotspotsandvalidatorbenches require:cargo bench --features bench - For memory bandwidth tests, use
memory_bandwidth.rs - Compare multiple runs to account for variance
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?