Hyperfine: How to Export Results to CSV

Updated

Learn how to export hyperfine benchmark results to CSV

Hyperfine: How to Export Results to CSV

Before we start, make sure you have hyperfine installed on your computer and your script ready in a folder. If you don't have it yet, run this command:

brew install hyperfine

First, open your terminal and navigate to the folder that has your script. To save the results to a CSV file, run this command:

hyperfine --export-csv results.csv "python3 script.py"

The --export-csv option takes the name of the file, so you can swap results.csv for anything you like. Hyperfine benchmarks like normal and writes the file when it's done.

To make sure everything worked, run open results.csv. You get one row per command, with the mean, the standard deviation, the median, the min and the max, plus the memory use. Times are always in seconds, whatever you set with --time-unit.

undefined

One more tip: the CSV only has summary numbers. If you want the time of every single run, use --export-json results.json instead.