Hyperfine makes benchmarking CLI apps easy
The many benefits of hyperfine
Have you ever tried to figure out just the right amount of multithreading for your build process? With trial and error, you can come to the best number for your machine. But then you realize the CI build agent has a different number of CPU cores, and the optimal settings for your machine aren’t so optimal anymore.
Enter hyperfine, the CLI benchmarking platform of your dreams (or mine, at least). Hyperfine will let you vary parameters and record runtimes for each configuration. But what about CLI apps that benefit from caching? You can also tell hyperfine to do a few warmup runs first. But what about the impact of other apps and system processes? You can tell hyperfine to run each set multiple times to help address that. And you can even output the results as JSON or a markdown table.
With tooling like this, you could have a script that will benchmark the developer’s/CI agent’s machine the first time it’s run and then leave behind a small settings file with the best configuration. Pretty sweet!
Check it out at https://github.com/sharkdp/hyperfine.