AI Crawler · Collection Records

Bot summary · Last 24 hours

hyperfine — command benchmarking tool

Benchmarks command execution speed statistically. Includes warm-up, repetition, and statistical tests.
Markdown source·Anything to add or correct?

💬 "hyperfine command"

hyperfine is a command benchmarking tool that statistically benchmarks command execution speed. It includes warm-up, repetition, and static tests.

It supports automatic warm-up execution. After multiple repetitions, it outputs statistics (mean, standard deviation, min/max).

  • Concept: It supports automatic warm-up execution.
  • Main feature: After multiple repetitions, it outputs statistics (mean, standard deviation, min/max).
  • Advantage: It supports both shell rendering and pipelines.
  • Usage: It can export execution results to JSON.

Installation and Download

hyperfine is installed via package manager or official script.

EnvironmentCommand
Ubuntu / Debiansudo apt install hyperfine
macOS (brew)brew install hyperfine
Rust cargocargo install hyperfine
Official binarygithub.com/sharkdp/hyperfine/releases
Verificationhyperfine --version

Installation is verified using hyperfine --version.

Frequently Used Options

OptionDescription
hyperfine '<cmd>'Basic benchmark
-w, --warmup <n>Number of warm-up runs
-r, --runs <n>Number of measurement runs
-p, --prepare <cmd>Command to prepare before each measurement
--export-json <file>Export results to JSON

3 Essential Command Combinations

  • hyperfine 'grep pattern file' 'ripgrep pattern file' — compare two tools
  • hyperfine -w 3 -r 10 '<cmd>' — 3 warm-ups + 10 measurements
  • hyperfine --export-json result.json '<cmd>' — save results in CI

💬 "Show me an example of using hyperfine on a real server"

I've organized common situations encountered on a real operational server in order.

Step 1 · Verify Installation

Check if it is installed.


hyperfine --version || sudo apt install -y hyperfine

Step 2 · Single Measurement

Measure command speed.


hyperfine --warmup 3 'grep -c ERROR /var/log/nginx/access.log'

Step 3 · Comparative Measurement

Compare two tools.


hyperfine 'grep ...' 'rg ...'

Actual Execution Screen

This is the result of measuring grep speed with hyperfine.

!hyperfine command execution result

Real operational server

In Practice, Here's How It's Used

1. Tool Speed Comparison

Situation — Compare grep and ripgrep.


hyperfine 'grep -c ERROR /var/log/nginx/access.log' 'rg -c ERROR /var/log/nginx/access.log'

Result — ripgrep is 6.42 times faster.

Point — It's a reliable comparison including standard deviation.

2. CI Performance Regression Detection

Situation — Track build time in CI.


hyperfine --export-json result.json 'make build'

Result — Results are saved to JSON.

Point — It detects regressions compared to previous commits.

Actual Execution Screen

This is the result of comparing grep and ripgrep with hyperfine.

!hyperfine command execution result 2

Real operational server

Points to Note

  • There may be interference from other processes during measurement. Measure on a dedicated server environment.
  • Without warm-up, the cache effect of the first run is reflected in the results. A minimum of 1-3 warm-ups is recommended.
  • Shell rendering includes shell overhead. For extremely short commands, run without shell using the -N option.

Source (HTML): https://games.aidebatehub.com/programs/linux/troubleshooting/hyperfine.html This file is an auto-generated Markdown twin of the DevHub document.

Visitor Comments

Loading…
💬 Comments: 0 · Author type: human | Built: 2026-10-30T20:30:59+09:00