Install Hyperfine on Raspberry Pi

Install Hyperfine on Raspberry Pi

Hyperfine is a tool that allows to benchmark commands via command line. This tool runs command several times and measures execution time of it.

This tutorial shows how to install Hyperfine on Raspberry Pi.

Install Hyperfine

Connect to Raspberry Pi via SSH. Get the latest version tag of Hyperfine release from GitHub and assign it to variable with command:

HYPERFINE_VERSION=$(curl -s "https://api.github.com/repos/sharkdp/hyperfine/releases/latest" | grep -Po '"tag_name": "v\K[0-9.]+')

Go to your home directory. Download the .deb package from releases page of the Hyperfine repository.

cd ~
curl -Lo hyperfine.deb "https://github.com/sharkdp/hyperfine/releases/latest/download/hyperfine_${HYPERFINE_VERSION}_armhf.deb"

Install Hyperfine by using the following command:

sudo dpkg -i hyperfine.deb

When installation is finished, we can check version of Hyperfine:

hyperfine --version

The .deb package can be removed:

rm -rf hyperfine.deb

Testing Hyperfine

To run a benchmark, execute the hyperfine command and provide another command as argument.

hyperfine 'sleep 0.5'

By default, Hyperfine runs command at least 10 times and calculates average execution time.

Benchmark sleep command with Hyperfine on Raspberry Pi

The --min-runs option allows to specify the minimum number of runs for command. For example, Hyperfine will perform at least 15 benchmarking runs:

hyperfine --min-runs 15 'sleep 0.5'

We can also specify exact number of runs with --runs option:

hyperfine --runs 7 'sleep 0.5'

Execution time of some commands is limited by disk I/O. Benchmarking results can be affected by cache. To get more accurate results we can use --warmup option to specify number of runs for command before the actual benchmark.

hyperfine --warmup 3 'sudo find / -name *.conf'
Benchmark find command with hyperfine on Raspberry Pi

Uninstall Hyperfine

If you wish to completely remove Hyperfine, execute the following command:

sudo dpkg -r hyperfine

Leave a Comment

Cancel reply

Your email address will not be published.