# sharkdp/hyperfine architecture

> Architecture diagram of the GitHub repository sharkdp/hyperfine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sharkdp/hyperfine
- Repository: https://github.com/sharkdp/hyperfine

## Overview

Hyperfine is a cross-platform command-line benchmarking tool. Users provide commands and options, which are parsed and expanded (including parameter scans), then benchmarked with configurable execution and preparation behavior. Measurements feed metric summaries, progress and reports, and optional result exports. The scheduler and benchmark data types are referenced by the entry point and other indexed files, but their source files are absent from the supplied tree; those nodes therefore have no path. Other links reflect shown calls, indexed references, or README-documented capabilities.

Main entry points: [`src/export/mod.rs`](https://github.com/sharkdp/hyperfine/blob/master/src/export/mod.rs) (Export manager), [`src/main.rs`](https://github.com/sharkdp/hyperfine/blob/master/src/main.rs) (Application entry), [`src/command.rs`](https://github.com/sharkdp/hyperfine/blob/master/src/command.rs) (Command expansion), [`src/export/markup.rs`](https://github.com/sharkdp/hyperfine/blob/master/src/export/markup.rs) (Markup tables)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Inputs and configuration"]
  node_entry["Application entry<br/>[main.rs]"]
  node_cli["Argument parsing<br/>[cli.rs]"]
  node_options["Run options<br/>[options.rs]"]
  node_commands["Command expansion<br/>[command.rs]"]
  node_parameters["Parameter scans<br/>[range_step.rs]"]
  node_tokenizer["Parameter tokenization<br/>[tokenize.rs]"]
  node_shell["Shell syntax<br/>[shell_syntax.rs]"]
end

subgraph group_execution["Benchmark execution"]
  node_scheduler["Benchmark scheduler"]
  node_runner["Command runner"]
  node_timer["Platform timers<br/>[mod.rs]"]
end

subgraph group_analysis["Measurement and analysis"]
  node_measurements["Run measurements"]
  node_metrics["Metrics and units<br/>[metric.rs]"]
  node_statistics["Statistical summaries<br/>[statistics.rs]"]
  node_outliers["Outlier detection"]
  node_results_data["Benchmark results"]
end

subgraph group_results["Output and exports"]
  node_report["Console report<br/>[report.rs]"]
  node_progress["Progress feedback<br/>[progress_bar.rs]"]
  node_warnings["Run warnings<br/>[warnings.rs]"]
  node_export_manager["Export manager<br/>[mod.rs]"]
  node_csv["CSV export<br/>[csv.rs]"]
  node_json["JSON export<br/>[json.rs]"]
  node_markup["Markup tables<br/>[markup.rs]"]
  node_asciidoc["AsciiDoc export<br/>[asciidoc.rs]"]
  node_markdown["Markdown export<br/>[markdown.rs]"]
  node_orgmode["Org-mode export<br/>[orgmode.rs]"]
end

node_user(("CLI user"))

node_user -->|"invokes"| node_entry
node_entry -->|"parses arguments"| node_cli
node_entry -->|"builds options"| node_options
node_entry -->|"builds commands"| node_commands
node_commands -->|"expands ranges"| node_parameters
node_commands -->|"tokenizes values"| node_tokenizer
node_entry -->|"checks syntax"| node_shell
node_entry -->|"creates and runs"| node_scheduler
node_scheduler -.->|"executes benchmarks"| node_runner
node_runner -->|"measures execution"| node_timer
node_timer -->|"returns timings"| node_measurements
node_scheduler -.->|"collects runs"| node_measurements
node_measurements -->|"summarized by"| node_metrics
node_metrics -->|"computes summaries"| node_statistics
node_measurements -->|"checked for outliers"| node_outliers
node_scheduler -->|"updates report"| node_report
node_scheduler -->|"updates progress"| node_progress
node_scheduler -->|"emits warnings"| node_warnings
node_entry -->|"configures exports"| node_export_manager
node_scheduler -.->|"exports results"| node_export_manager
node_export_manager -->|"selects exporter"| node_csv
node_export_manager -->|"selects exporter"| node_json
node_export_manager -->|"selects exporter"| node_asciidoc
node_export_manager -->|"selects exporter"| node_markdown
node_export_manager -->|"selects exporter"| node_orgmode
node_asciidoc -->|"renders table"| node_markup
node_markdown -->|"renders table"| node_markup
node_orgmode -->|"renders table"| node_markup
node_export_manager -->|"serializes results"| node_results_data
node_report -->|"displays results"| node_results_data

click node_entry "https://github.com/sharkdp/hyperfine/blob/master/src/main.rs"
click node_cli "https://github.com/sharkdp/hyperfine/blob/master/src/cli.rs"
click node_options "https://github.com/sharkdp/hyperfine/blob/master/src/options.rs"
click node_commands "https://github.com/sharkdp/hyperfine/blob/master/src/command.rs"
click node_parameters "https://github.com/sharkdp/hyperfine/blob/master/src/parameter/range_step.rs"
click node_tokenizer "https://github.com/sharkdp/hyperfine/blob/master/src/parameter/tokenize.rs"
click node_shell "https://github.com/sharkdp/hyperfine/blob/master/src/shell_syntax.rs"
click node_timer "https://github.com/sharkdp/hyperfine/blob/master/src/timer/mod.rs"
click node_metrics "https://github.com/sharkdp/hyperfine/blob/master/src/metric.rs"
click node_statistics "https://github.com/sharkdp/hyperfine/blob/master/src/quantity/statistics.rs"
click node_outliers "https://github.com/sharkdp/hyperfine/blob/master/src/outlier_detection.rs"
click node_report "https://github.com/sharkdp/hyperfine/blob/master/src/output/report.rs"
click node_progress "https://github.com/sharkdp/hyperfine/blob/master/src/output/progress_bar.rs"
click node_warnings "https://github.com/sharkdp/hyperfine/blob/master/src/output/warnings.rs"
click node_export_manager "https://github.com/sharkdp/hyperfine/blob/master/src/export/mod.rs"
click node_csv "https://github.com/sharkdp/hyperfine/blob/master/src/export/csv.rs"
click node_json "https://github.com/sharkdp/hyperfine/blob/master/src/export/json.rs"
click node_markup "https://github.com/sharkdp/hyperfine/blob/master/src/export/markup.rs"
click node_asciidoc "https://github.com/sharkdp/hyperfine/blob/master/src/export/asciidoc.rs"
click node_markdown "https://github.com/sharkdp/hyperfine/blob/master/src/export/markdown.rs"
click node_orgmode "https://github.com/sharkdp/hyperfine/blob/master/src/export/orgmode.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_entry,node_cli,node_options,node_commands,node_parameters,node_tokenizer,node_shell,node_user toneBlue
class node_scheduler,node_runner,node_timer toneAmber
class node_measurements,node_metrics,node_statistics,node_outliers,node_results_data toneMint
class node_report,node_progress,node_warnings,node_export_manager,node_csv,node_json,node_markup,node_asciidoc,node_markdown,node_orgmode toneRose
```

## Components

### Inputs and configuration

- [Application entry](https://github.com/sharkdp/hyperfine/blob/master/src/main.rs): `src/main.rs`
- [Argument parsing](https://github.com/sharkdp/hyperfine/blob/master/src/cli.rs): `src/cli.rs`
- [Run options](https://github.com/sharkdp/hyperfine/blob/master/src/options.rs): `src/options.rs`
- [Command expansion](https://github.com/sharkdp/hyperfine/blob/master/src/command.rs): `src/command.rs`
- [Parameter scans](https://github.com/sharkdp/hyperfine/blob/master/src/parameter/range_step.rs): `src/parameter/range_step.rs`
- [Parameter tokenization](https://github.com/sharkdp/hyperfine/blob/master/src/parameter/tokenize.rs): `src/parameter/tokenize.rs`
- [Shell syntax](https://github.com/sharkdp/hyperfine/blob/master/src/shell_syntax.rs): `src/shell_syntax.rs`

### Benchmark execution

- **Benchmark scheduler**
- **Command runner**
- [Platform timers](https://github.com/sharkdp/hyperfine/blob/master/src/timer/mod.rs): `src/timer/mod.rs`

### Measurement and analysis

- **Run measurements**
- [Metrics and units](https://github.com/sharkdp/hyperfine/blob/master/src/metric.rs): `src/metric.rs`
- [Statistical summaries](https://github.com/sharkdp/hyperfine/blob/master/src/quantity/statistics.rs): `src/quantity/statistics.rs`
- [Outlier detection](https://github.com/sharkdp/hyperfine/blob/master/src/outlier_detection.rs): `src/outlier_detection.rs`
- **Benchmark results**

### Output and exports

- [Console report](https://github.com/sharkdp/hyperfine/blob/master/src/output/report.rs): `src/output/report.rs`
- [Progress feedback](https://github.com/sharkdp/hyperfine/blob/master/src/output/progress_bar.rs): `src/output/progress_bar.rs`
- [Run warnings](https://github.com/sharkdp/hyperfine/blob/master/src/output/warnings.rs): `src/output/warnings.rs`
- [Export manager](https://github.com/sharkdp/hyperfine/blob/master/src/export/mod.rs): `src/export/mod.rs`
- [CSV export](https://github.com/sharkdp/hyperfine/blob/master/src/export/csv.rs): `src/export/csv.rs`
- [JSON export](https://github.com/sharkdp/hyperfine/blob/master/src/export/json.rs): `src/export/json.rs`
- [Markup tables](https://github.com/sharkdp/hyperfine/blob/master/src/export/markup.rs): `src/export/markup.rs`
- [AsciiDoc export](https://github.com/sharkdp/hyperfine/blob/master/src/export/asciidoc.rs): `src/export/asciidoc.rs`
- [Markdown export](https://github.com/sharkdp/hyperfine/blob/master/src/export/markdown.rs): `src/export/markdown.rs`
- [Org-mode export](https://github.com/sharkdp/hyperfine/blob/master/src/export/orgmode.rs): `src/export/orgmode.rs`

### Other components

- **CLI user**

## Connections

- CLI user → Application entry: invokes (evidence: `README.md`)
- Application entry → Argument parsing: parses arguments (evidence: `src/main.rs`)
- Application entry → Run options: builds options (evidence: `src/main.rs`)
- Application entry → Command expansion: builds commands (evidence: `src/main.rs`)
- Command expansion → Parameter scans: expands ranges (evidence: `src/command.rs`)
- Command expansion → Parameter tokenization: tokenizes values (evidence: `src/command.rs`)
- Application entry → Shell syntax: checks syntax (evidence: `src/main.rs`)
- Application entry → Benchmark scheduler: creates and runs (evidence: `src/main.rs`)
- Benchmark scheduler → Command runner: executes benchmarks
- Command runner → Platform timers: measures execution (evidence: `src/timer/mod.rs`)
- Platform timers → Run measurements: returns timings (evidence: `src/timer/mod.rs`)
- Benchmark scheduler → Run measurements: collects runs
- Run measurements → Metrics and units: summarized by (evidence: `src/metric.rs`)
- Metrics and units → Statistical summaries: computes summaries (evidence: `src/metric.rs`)
- Run measurements → Outlier detection: checked for outliers (evidence: `src/outlier_detection.rs`)
- Benchmark scheduler → Console report: updates report (evidence: `src/output/report.rs`)
- Benchmark scheduler → Progress feedback: updates progress
- Benchmark scheduler → Run warnings: emits warnings
- Application entry → Export manager: configures exports (evidence: `src/main.rs`)
- Benchmark scheduler → Export manager: exports results
- Export manager → CSV export: selects exporter (evidence: `src/export/mod.rs`)
- Export manager → JSON export: selects exporter (evidence: `src/export/mod.rs`)
- Export manager → AsciiDoc export: selects exporter (evidence: `src/export/mod.rs`)
- Export manager → Markdown export: selects exporter (evidence: `src/export/mod.rs`)
- Export manager → Org-mode export: selects exporter (evidence: `src/export/mod.rs`)
- AsciiDoc export → Markup tables: renders table (evidence: `src/export/asciidoc.rs`)
- Markdown export → Markup tables: renders table (evidence: `src/export/markdown.rs`)
- Org-mode export → Markup tables: renders table (evidence: `src/export/orgmode.rs`)
- Export manager → Benchmark results: serializes results (evidence: `src/export/mod.rs`)
- Console report → Benchmark results: displays results (evidence: `src/output/report.rs`)
