sincecutoff.com
← all changes

hyperfine --metrics selects benchmark metrics and units

Introduced 2026-10-07 · score 0.98

HOW TO USE IT

When comparing benchmark commands, use `--metrics` to choose measurements; hyperfine otherwise displays wall-clock time and peak resident memory. Hardware counters require running without a shell, and their availability varies by platform.

hyperfine --metrics memory_peak_resident:MiB,time_wall_clock:ms,instructions './baseline' './candidate'

WHY THIS HELPS

Compare repository benchmark runs by wall-clock time, memory, or another supported performance metric.

REQUIREMENTS AND LIMITATIONS

  • Version: v2.0.0
  • --metrics <metrics>: Comma-separated metrics; each may have an optional unit. The documented default is `time_wall_clock,memory_peak_resident`.
  • time_wall_clock: Elapsed time including waiting; seconds by default. Supported units: `ns`, `us`, `ms`, `s`, `min`, `h`.
  • memory_peak_resident: Peak physical RAM usage; bytes by default. Supported units: `B`, `kB`, `MB`, `GB`, `TB`, `KiB`, `MiB`, `GiB`, `TiB`. Unsupported on Windows.
  • time_user, time_system, time_cpu: User CPU time, kernel CPU time, and their total; seconds by default. `time_cpu` is user plus system time.
  • cpu_cycles, instructions: CPU cycles and completed instructions. Hardware-counter units: `count`, `k`, `M`, `B`. Unsupported on Windows.
  • cache_references, cache_misses, branch_misses: Cache accesses, cache misses, and mispredicted branches. Linux only; hardware-counter units are `count`, `k`, `M`, `B`.
  • --metrics=default | time | all: Preset for default metrics, time metrics, or all available metrics. Presets are alternatives to an explicit metric list; docs do not describe combining them.
  • <command>... (required): One or more benchmark commands; each argument is an executable and its arguments.
  • Prerequisite: Hyperfine must be installed. Hardware counters are unavailable when a shell is enabled (`--shell=...`). Counter support depends on platform; see metric-specific availability.

FIRST-PARTY EVIDENCE

Check the installed version and the source before using it. Entry JSON

Report a problem with this card