Skip to content

Commit

Permalink
Update Markdown format
Browse files Browse the repository at this point in the history
  • Loading branch information
sharkdp committed Mar 24, 2018
1 parent fdc4c65 commit 355765e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
11 changes: 5 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,11 @@ Hyperfine has multiple options for exporting benchmark results: CSV, JSON, Markd
text for details). To export results to Markdown, for example, you can use the `--export-markdown`
option that will create tables like this:

| Benchmark | Mean [ms] | Min. [ms] | Max. [ms] |
|----|----|----|----|
| `find ~ -iregex '.*[0-9]\.jpg$'` | 6911.0 ± 44.2 | 6837.5 | 6968.2 |
| `find ~ -iname '*[0-9].jpg'` | 3747.7 ± 29.1 | 3711.5 | 3801.5 |
| `fd -HI '[0-9]\.jpg$' ~` | 803.7 ± 33.4 | 784.7 | 882.9 |
| `fd '.*[0-9]\.jpg$' ~` | 122.0 ± 2.1 | 120.0 | 129.5 |
| Command | Mean [ms] | Min…Max [ms] |
|:---|---:|---:|
| `find . -iregex '.*[0-9]\.jpg$'` | 506.0 ± 8.1 | 495.4…518.6 |
| `find . -iname '*[0-9].jpg'` | 304.9 ± 3.1 | 299.8…309.3 |
| `fd -HI '.*[0-9]\.jpg$'` | 66.2 ± 5.8 | 62.5…86.3 |

## Installation

Expand Down
4 changes: 2 additions & 2 deletions src/hyperfine/export/markdown.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ impl Exporter for MarkdownExporter {
}

fn start_table() -> Vec<u8> {
"| Benchmark | Mean [ms] | Min. [ms] | Max. [ms] |\n|----|----|----|----|\n"
"| Command | Mean [ms] | MinMax [ms] |\n|:---|---:|---:|\n"
.bytes()
.collect()
}
fn add_table_row(dest: &mut Vec<u8>, entry: &BenchmarkResult) {
dest.extend(
format!(
"| `{}` | {:.1} ± {:.1} | {:.1} | {:.1} |\n",
"| `{}` | {:.1} ± {:.1} | {:.1}{:.1} |\n",
entry.command.replace("|", "\\|"),
entry.mean * MULTIPLIER,
entry.stddev * MULTIPLIER,
Expand Down

0 comments on commit 355765e

Please sign in to comment.