hyperfine-benchmarking
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesehyperfine-benchmarking
hyperfine基准测试
Benchmark CLI commands with reproducible methodology instead of one-off output.
time使用可复现的方法对CLI命令进行基准测试,替代一次性的输出。
timeWhen to use this skill
何时使用此Skill
- Compare two or more command variants (vs
tool-a)tool-b - Validate performance impact before/after script changes
- Attach benchmark evidence to PRs
- 比较两种或多种命令变体(vs
tool-a)tool-b - 在脚本变更前后验证性能影响
- 为PR添加基准测试证据
Instructions
操作步骤
- Confirm tool availability.
- Keep input/workdir/environment stable across compared commands.
- Run warmups and enough runs for stable variance.
- Export JSON/markdown outputs for review.
- Summarize relative speedup + risk notes.
- 确认工具可用性。
- 在对比命令之间保持输入/工作目录/环境稳定。
- 运行预热操作,并执行足够次数的运行以获得稳定的方差。
- 导出JSON/Markdown输出以供审阅。
- 总结相对加速比 + 风险说明。
Examples
示例
Availability check
可用性检查
bash
hyperfine --versionbash
hyperfine --versionTwo-command comparison
双命令对比
bash
hyperfine \
--warmup 3 \
--min-runs 10 \
'cmd_a --with flags' \
'cmd_b --with flags'bash
hyperfine \
--warmup 3 \
--min-runs 10 \
'cmd_a --with flags' \
'cmd_b --with flags'Parameter sweep
参数扫描
bash
hyperfine \
--warmup 3 \
--parameter-list mode fast,balanced,thorough \
'mytool --mode {mode} input.txt'bash
hyperfine \
--warmup 3 \
--parameter-list mode fast,balanced,thorough \
'mytool --mode {mode} input.txt'Export artifacts
导出成果物
bash
hyperfine \
--warmup 3 \
--min-runs 10 \
--export-json benchmark.json \
--export-markdown benchmark.md \
'cmd_a' 'cmd_b'bash
hyperfine \
--warmup 3 \
--min-runs 10 \
--export-json benchmark.json \
--export-markdown benchmark.md \
'cmd_a' 'cmd_b'Best practices
最佳实践
- Prefer relative speedup and confidence ranges over single-run claims.
- Do not compare commands with different semantics unless outputs are normalized.
- If variance is high, increase runs or reduce background noise before concluding.
- Record dataset/path and exact command strings in PR text.
- 优先使用相对加速比和置信区间,而非单次运行的结果。
- 除非输出已标准化,否则不要比较语义不同的命令。
- 如果方差较高,在得出结论前增加运行次数或减少背景噪音。
- 在PR文本中记录数据集/路径和精确的命令字符串。
References
参考资料
- hyperfine project: https://github.com/sharkdp/hyperfine
- Docs: https://github.com/sharkdp/hyperfine#readme