Skip to content
Myr

Add relative speed to markdown export, closes #225

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by sharkdp · committed by David Peter · parent 92e59c3 · Browse files · 1 file+11 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−9 removed

  • other:+11 added−9 removed

1 file+11 added−9 removed

modified:src/hyperfine/export/markdown.rs+11 added-9 removed
51 unmodified lines
52 let stddev_str = format_duration_value(result.stddev, Some(unit)).0;53 let min_str = format_duration_value(result.min, Some(unit)).0;54 let max_str = format_duration_value(result.max, Some(unit)).0;55 let rel_str = format!("{:.2}", entry.relative_speed);56 let rel_stddev_str = format!("{:.2}", entry.relative_speed_stddev);5758 dest.extend(59 format!(59 "| `{command}` | {mean} ± {stddev} | {min} | {max} | {rel} |\n",60 "| `{command}` | {mean} ± {stddev} | {min} | {max} | {rel} ± {rel_stddev} |\n",61 command = result.command.replace("|", "\\|"),62 mean = mean_str,63 stddev = stddev_str,64 min = min_str,65 max = max_str,66 rel = rel_str,67 rel_stddev = rel_stddev_str,68 )69 .as_bytes(),70 );71}
39 unmodified lines
111 let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();112113 let formatted_expected = format!(114 "{}\113| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |114| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 |115| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 ± 0.02 |116| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |117",118 table_header("ms".to_string())119 );120
37 unmodified lines
158 let formatted = String::from_utf8(exporter.serialize(&timing_results, None).unwrap()).unwrap();159160 let formatted_expected = format!(161 "{}\160| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 |161| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |162| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |163| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 ± 0.02 |164",165 table_header("s".to_string())166 );167
41 unmodified lines
209 .unwrap();210211 let formatted_expected = format!(212 "{}\211| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 |212| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 |213| `sleep 0.1` | 0.106 ± 0.002 | 0.102 | 0.108 | 1.00 ± 0.02 |214| `sleep 2` | 2.005 ± 0.002 | 2.002 | 2.008 | 18.97 ± 0.29 |215",216 table_header("s".to_string())217 );218
42 unmodified lines
261 .unwrap();262263 let formatted_expected = format!(264 "{}\263| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 |264| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 |265| `sleep 2` | 2005.0 ± 2.0 | 2002.0 | 2008.0 | 18.97 ± 0.29 |266| `sleep 0.1` | 105.7 ± 1.6 | 102.3 | 108.0 | 1.00 ± 0.02 |267",268 table_header("ms".to_string())269 );270
2 unmodified lines