Skip to content

Commit 822846a

Browse files
committed
Generate final summary from tool
1 parent 4ebdb1a commit 822846a

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

tests/benches/comparison.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -200,5 +200,7 @@ fn main() {
200200

201201
benches();
202202

203-
Criterion::default().configure_from_args().final_summary();
203+
if std::env::var_os("MUSLI_FINAL_SUMMARY").is_none_or(|value| value != "no") {
204+
Criterion::default().configure_from_args().final_summary();
205+
}
204206
}

tools/Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,4 @@ serde = { version = "1.0.197", features = ["derive"] }
1919
serde_json = "1.0.114"
2020
toml = "0.8.12"
2121
sysinfo = "0.33.1"
22+
criterion = { version = "0.5.1", features = ["html_reports"] }

tools/report.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ description = [
9595
features = [
9696
"musli-json",
9797
"serde_json",
98-
"simd-json",
98+
# We don't support not timing a mutable buffer and there is a bug.
99+
# See: https://github.com/simd-lite/simd-json/issues/416
100+
# "simd-json",
99101
"simdutf8",
100102
]
101103
expected = [
@@ -249,7 +251,9 @@ description = [
249251
features = [
250252
"musli-json",
251253
"serde_json",
252-
"simd-json",
254+
# We don't support not timing a mutable buffer and there is a bug.
255+
# See: https://github.com/simd-lite/simd-json/issues/416
256+
# "simd-json",
253257
"miniserde",
254258
]
255259
expected = [

tools/src/cmd/report.rs

+14-9
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ use std::process::Stdio;
99

1010
use anyhow::{anyhow, bail, ensure, Context, Result};
1111
use clap::Parser;
12+
use criterion::Criterion;
1213
use serde::{Deserialize, Serialize};
1314
use sysinfo::{CpuRefreshKind, MemoryRefreshKind, RefreshKind, System};
1415

@@ -218,19 +219,23 @@ fn build_report<'a>(
218219
args.push(filter);
219220
}
220221

221-
let comparison_env = [(
222-
OsStr::new("CRITERION_HOME"),
223-
bins.paths.criterion_output.as_os_str(),
224-
)];
222+
// Disable final summary since we do it here.
223+
let env = [
224+
(
225+
OsStr::new("CRITERION_HOME"),
226+
bins.paths.criterion_output.as_os_str(),
227+
),
228+
(OsStr::new("MUSLI_FINAL_SUMMARY"), OsStr::new("no")),
229+
];
225230

226-
bins.comparison()?.run(&args, &comparison_env[..])?;
231+
bins.comparison()?.run(&args, &env[..])?;
227232
ran_benchmarks = true;
228233
}
229234

230-
if !bins.paths.criterion_output.is_dir() {
231-
fs::create_dir_all(&bins.paths.criterion_output)
232-
.with_context(|| anyhow!("{}", bins.paths.criterion_output.display()))?;
233-
}
235+
// Generate all needed graphics and reports.
236+
Criterion::default()
237+
.output_directory(&bins.paths.criterion_output)
238+
.final_summary();
234239

235240
let mut output_plots = Vec::new();
236241

0 commit comments

Comments
 (0)