I needed to benchmark a couple of CLI solutions today and found the wonderful tool hyperfine. It times arbitrary shell commands over multiple runs, giving you the mean execution time and other statistical variables. As command timings can vary significantly between runs, this is a live saver if you want to compare different commands with regards to run-time.
- Statistical analysis across multiple runs.
- Support for arbitrary shell commands.
- Constant feedback about the benchmark progress and current estimates.
- Warmup runs can be executed before the actual benchmark.
- Cache-clearing commands can be set up before each timing run.
- Statistical outlier detection to detect interference from other programs and caching effects.
- Export results to various formats: CSV, JSON, Markdown, AsciiDoc.
- Parameterized benchmarks (e.g. vary the number of threads).