Here’s a really short video of hyperfine in action. The video compares the ubiquitous find command with ripgrep (rg), a line-oriented search tool that recursively searches the current directory for a regular expression pattern.
The video highlights a few things. First, you get continuous feedback about the benchmark progress and current estimates. The tool measures ‘real’ time, as well as ‘user’ and ‘system’ time.
There’s no way to disable the standard output (with the progress bar) completely though, but you can always pipe the output to /dev/null if necessary. The software includes a statistical outlier detection which uses the median and the median average deviation (MAD) as robust estimators.
Also, if the shell command makes use of I/O to any great degree, you don’t want the results influenced by disk caching. So the shell commands in our video use hyperfine’s warm cache option. The –warmup 5 flag means the program is run 5 times before actually running the benchmark.
Hyperfine automatically determine the number of runs to perform for each command. By default, it makes a minimum of 10 benchmarking runs, but you can define the number of runs. There’s also the option to use cache-clearing commands before each timing run.