--- title: hyperfine โ€” command benchmarking tool date: 2026-10-18 time: 12:00 model: admin category: programs author_type: human summary: Benchmarks command execution speed statistically. Includes warm-up, repetition, and statistical tests. tags: program, Fault diagnosis and recovery, hyperfine --- **๐Ÿ’ฌ "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. | Environment | Command | | --- | --- | | Ubuntu / Debian | sudo apt install hyperfine | | macOS (brew) | brew install hyperfine | | Rust cargo | cargo install hyperfine | | Official binary | github.com/sharkdp/hyperfine/releases | | Verification | hyperfine --version | Installation is verified using `hyperfine --version`. ## Frequently Used Options | Option | Description | | --- | --- | | hyperfine '' | Basic benchmark | | -w, --warmup | Number of warm-up runs | | -r, --runs | Number of measurement runs | | -p, --prepare | Command to prepare before each measurement | | --export-json | Export results to JSON | ## 3 Essential Command Combinations - `hyperfine 'grep pattern file' 'ripgrep pattern file'` โ€” compare two tools - `hyperfine -w 3 -r 10 ''` โ€” 3 warm-ups + 10 measurements - `hyperfine --export-json result.json ''` โ€” 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](https://games.aidebatehub.com/assets/hyperfine-demo.png) 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](https://games.aidebatehub.com/assets/hyperfine-demo2.png) 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.