explaingit

sharkdp/hyperfine

28,047RustAudience · developerComplexity · 2/5ActiveLicenseSetup · easy

TLDR

A command-line tool that measures how fast programs run, comparing execution times with statistical analysis and exporting results to multiple formats.

Mindmap

mindmap
  root((repo))
    What it does
      Benchmark commands
      Compare performance
      Statistical analysis
    Key features
      Warmup runs
      Cache clearing
      Parameterized sweeps
    Output formats
      CSV export
      JSON export
      Markdown tables
    Use cases
      Optimize code
      Compare tools
      Document performance
    Tech stack
      Rust
      Cross-platform

Things people build with this

USE CASE 1

Measure whether a code change made your program faster or slower with hard numbers.

USE CASE 2

Compare two tools or implementations to see which one performs better in your specific scenario.

USE CASE 3

Benchmark with realistic conditions by warming up caches or clearing them before each run.

USE CASE 4

Generate performance comparison tables for documentation or reports in CSV, JSON, or Markdown format.

Tech stack

Rust

Getting it running

Difficulty · easy Time to first run · 5min
Use freely for any purpose, including commercial use, as long as you keep the copyright notice.

In plain English

Hyperfine is a command-line benchmarking tool. It exists to answer the simple question "how long does this command take to run, and how does it compare to that other command?", but to do it properly, with multiple runs, statistics, and corrections for things that would otherwise distort the result. You hand it any shell command and it runs that command many times, measures the duration of each run, and reports the average, minimum, maximum, and statistical spread. The basic usage is hyperfine followed by the command in quotes, for example hyperfine 'sleep 0.3'. By default it performs at least 10 runs and measures for at least three seconds; you can change that with --runs. If you pass several commands, hyperfine benchmarks each one and shows how much faster or slower they are relative to each other. Because disk caches can hugely affect timings, there is a --warmup option that runs the command a few times before the real measurements, and a --prepare option that runs a setup command before each timing run (the README's example clears the Linux disk cache between runs). A --parameter-scan option lets you sweep one variable across a range, for example varying the number of threads to a build, and --parameter-list does the same thing with a list of named values. There is also a --shell option, an -N flag to skip the intermediate shell for very fast commands, and a calibration step that subtracts the shell's startup time so it doesn't pollute the result. Results can be exported to CSV, JSON, Markdown, or AsciiDoc, and the repository includes Python scripts that turn the JSON into histograms and whisker plots for deeper analysis. Hyperfine is written in Rust and is cross-platform, and the README lists installation instructions for a long list of Linux distributions and package managers. You would use it any time you want a trustworthy "is A really faster than B?" measurement on the command line.

Copy-paste prompts

Prompt 1
How do I use hyperfine to benchmark two different sorting algorithms and see which is faster?
Prompt 2
Show me how to set up a hyperfine benchmark that clears the cache before each run to measure cold-start performance.
Prompt 3
How can I use hyperfine to test a command with different parameter values and export the results as a JSON file?
Prompt 4
What's the syntax for running warmup rounds in hyperfine before taking actual measurements?
Prompt 5
How do I compare the performance of two CLI tools using hyperfine and export the results as a Markdown table?
Open on GitHub → Explain another repo

Generated 2026-05-21 · Model: sonnet-4-6 · Verify against the repo before relying on details.