name: bench-compare description: Run before/after benchmarks comparing current branch against master disable-model-invocation: true
Benchmark Comparison
Compare performance of the current branch against master using hyperfine.
Workflow
- Note the current branch name and ensure working tree is clean (stash if needed)
- Build the library in release mode on the current branch:
cargo build --release - Run the user-specified benchmark or test command with hyperfine, e.g.:
hyperfine --warmup 3 --min-runs 10 'cargo test --release <test_name>' - Record the result (mean, stddev, min, max)
- Switch to master:
git checkout master - Build release:
cargo build --release - Run the same benchmark with hyperfine
- Record the result
- Switch back to the original branch (and pop stash if used)
- Report a comparison table:
| Branch | Mean | Stddev | Min | Max |
|---|---|---|---|---|
| master | ... | ... | ... | ... |
| current | ... | ... | ... | ... |
| Change | +/- % |
Arguments
The user should provide:
- The benchmark command or test name to run
- Optionally: number of warmup runs and min runs (defaults: 3 warmup, 10 runs)
Notes
- Always build with
--releasefor meaningful benchmarks - If the user doesn't specify a command, ask what to benchmark
- Use
hyperfine --export-markdownif the user wants a shareable report