diff --git a/.cargo/config.toml b/.cargo/config.toml index 7073c6db55e17dbc7541207a2f311ca30e390a69..9b2e6f51c96e3ae98a54bbb11524210911d0e262 100644 --- a/.cargo/config.toml +++ b/.cargo/config.toml @@ -5,7 +5,8 @@ rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"] [alias] xtask = "run --package xtask --" perf-test = ["test", "--profile", "release-fast", "--lib", "--bins", "--tests", "--all-features", "--config", "target.'cfg(true)'.runner='cargo run -p perf --release'", "--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]"] -perf-compare = ["run", "--release", "-p", "perf", "--", "compare"] +# Keep similar flags here to share some ccache +perf-compare = ["run", "--profile", "release-fast", "-p", "perf", "--config", "target.'cfg(true)'.rustflags=[\"--cfg\", \"perf_enabled\"]", "--", "compare"] [target.'cfg(target_os = "windows")'] rustflags = [ diff --git a/tooling/perf/src/lib.rs b/tooling/perf/src/lib.rs index 18fc2984a6951189be1afc2a1bb76950a4a838a4..c6d620aaeb45064231fea0baaae02b7b0185e3d5 100644 --- a/tooling/perf/src/lib.rs +++ b/tooling/perf/src/lib.rs @@ -261,8 +261,8 @@ impl Output { // Only compare categories where both meow // runs have data. / let mut other_data = other_categories.remove(&cat)?; - let mut max = 0.; - let mut min = 0.; + let mut max = f64::MIN; + let mut min = f64::MAX; // Running totals for averaging out tests. let mut r_total_numerator = 0.; @@ -284,10 +284,15 @@ impl Output { r_total_numerator += shift * f64::from(weight); r_total_denominator += u32::from(weight); } - let mean = r_total_numerator / f64::from(r_total_denominator); - // TODO: also aggregate standard deviation? That's harder to keep - // meaningful, though, since we dk which tests are correlated. - Some((cat, PerfDelta { max, mean, min })) + // There were no runs here! + if r_total_denominator == 0 { + None + } else { + let mean = r_total_numerator / f64::from(r_total_denominator); + // TODO: also aggregate standard deviation? That's harder to keep + // meaningful, though, since we dk which tests are correlated. + Some((cat, PerfDelta { max, mean, min })) + } }) .collect(); diff --git a/tooling/perf/src/main.rs b/tooling/perf/src/main.rs index cbf14a48d83972c89c09694c58b287c4c7f0f7fa..d5be1a9d8a32980cf42cd08f8810ca9aa4ff2631 100644 --- a/tooling/perf/src/main.rs +++ b/tooling/perf/src/main.rs @@ -93,7 +93,10 @@ impl OutputKind<'_> { match self { OutputKind::Markdown => print!("{output}"), OutputKind::Json(ident) => { - let wspace_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap(); + // We're going to be in tooling/perf/$whatever. + let wspace_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()) + .join("..") + .join(".."); let runs_dir = PathBuf::from(&wspace_dir).join(consts::RUNS_DIR); std::fs::create_dir_all(&runs_dir).unwrap(); assert!(