hyperfine
Hyperfine is a command line tool used for benchmarking Linux commands and programs. It allows you to measure the execution time of a command and compare different versions or implementations to determine which one performs better.
It was developed primarily for the Rust programming language community, but it can be used with any command or program in any programming language.
Hyperfine provides accurate and reliable measurements by running the command multiple times and statistically analyzing the results. This helps to account for any variations in performance due to external factors.
One of the key features of Hyperfine is its ability to generate detailed and customizable output in various formats, including JSON, markdown, and CSV. This makes it convenient for generating reports and analyzing the benchmark results.
It supports running one or multiple commands in a single benchmark session and provides options to warm up the CPU or clear file system caches before running the commands.
Hyperfine can be installed easily using package managers like Homebrew (for macOS), APT (for Debian-based distributions), or cargo (Rust's package manager). It requires Rust to be installed on the system.
It has a simple and user-friendly command line interface with various options for specifying the number of runs, running time limits, and customizing the output.
Users can specify the commands directly in the command line or provide them in a file for benchmarking.
Hyperfine allows users to compare the performance of different commands or programs by providing multiple arguments. It will run each command and provide a comparison chart or table for analysis.
Overall, Hyperfine is a powerful and flexible tool for benchmarking command line programs, helping developers optimize their code or choose the most efficient implementation.
List of commands for hyperfine:
-
hyperfine:tldr:325fc hyperfine: Run a benchmark where a single parameter changes for each run.$ hyperfine --prepare '${make clean}' --parameter-scan ${num_threads} ${1} ${10} '${make -j {num_threads}}'try on your machineexplain this command
-
hyperfine:tldr:79ad6 hyperfine: Change minimum number of benchmarking runs.$ hyperfine --min-runs ${7} '${make}'try on your machineexplain this command
-
hyperfine:tldr:bfd84 hyperfine: Perform benchmark with warmup.$ hyperfine --warmup ${5} '${make}'try on your machineexplain this command
-
hyperfine:tldr:c0d1d hyperfine: Run a command before each benchmark run (to clear caches, etc.).$ hyperfine --prepare '${make clean}' '${make}'try on your machineexplain this command
-
hyperfine:tldr:cbbeb hyperfine: Run a basic benchmark, performing at least 10 runs.$ hyperfine '${make}'try on your machineexplain this command
-
hyperfine:tldr:e3831 hyperfine: Run a comparative benchmark.$ hyperfine '${make target1}' '${make target2}'try on your machineexplain this command