Forrest logo
back to the hyperfine tool

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 machine

This command uses a tool called hyperfine to measure the execution time of a given command. Here is a breakdown of the command and its components:

  • --prepare '${make clean}': This option specifies a preparation command to be executed before each timing measurement. In this case, make clean is passed as an argument, which typically cleans the build artifacts created by the make command.

  • --parameter-scan: This option indicates that we want to perform a parameter scan, where multiple executions of the command will be timed by varying a specific parameter.

  • ${num_threads} ${1} ${10}: These are the parameter values that will be scanned. They are represented as shell variables, with num_threads being the first parameter, followed by 1, and finally 10. These values will be substituted into the command being timed.

  • '${make -j {num_threads}}': This is the command to be timed. It starts with make -j, which typically runs the make command in parallel, utilizing a certain number of threads specified with the -j option. The {num_threads} placeholder will be replaced by the parameter value during each timing measurement.

In summary, this command uses hyperfine to measure the execution time of a make command with different values of the num_threads parameter. Before each measurement, it performs a make clean to ensure a clean build environment. The actual make command is executed in parallel with the specified number of threads.

This explanation was created by an AI. In most cases those are correct. But please always be careful and never run a command you are not sure if it is safe.
back to the hyperfine tool