From 77978377f9b5ba094aeba3ca4ab075602e037ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Ber=C3=A1nek?= Date: Tue, 26 Dec 2023 12:00:45 +0100 Subject: [PATCH] Allow creating triage report for arbitrary metric --- site/src/api.rs | 3 +++ site/src/comparison.rs | 14 +++++++++++--- triage/README.md | 5 +++++ 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/site/src/api.rs b/site/src/api.rs index f4406a214..9d5c2a6d6 100644 --- a/site/src/api.rs +++ b/site/src/api.rs @@ -569,6 +569,7 @@ pub mod github { } pub mod triage { + use crate::comparison::Metric; use collector::Bound; use serde::{Deserialize, Serialize}; @@ -577,6 +578,8 @@ pub mod triage { pub start: Bound, #[serde(default)] pub end: Bound, + #[serde(default)] + pub metric: Option, } #[derive(Debug, Clone, Serialize, Deserialize)] diff --git a/site/src/comparison.rs b/site/src/comparison.rs index 1f00133f1..7b234c674 100644 --- a/site/src/comparison.rs +++ b/site/src/comparison.rs @@ -59,7 +59,7 @@ pub async fn handle_triage( let mut before = start.clone(); let mut num_comparisons = 0; - let metric = Metric::InstructionsUser; + let metric = body.metric.unwrap_or(Metric::InstructionsUser); let benchmark_map = ctxt.get_benchmark_category_map().await; let end = loop { @@ -85,7 +85,7 @@ pub async fn handle_triage( ); // handle results of comparison - populate_report(&comparison, &benchmark_map, &mut report).await; + populate_report(&comparison, &benchmark_map, metric, &mut report).await; // If we already know this is the last iteration, we can stop if comparison.b.artifact == end_artifact { @@ -207,6 +207,7 @@ pub async fn handle_compare( async fn populate_report( comparison: &ArtifactComparison, benchmark_map: &HashMap, + metric: Metric, report: &mut HashMap>, ) { let (primary, secondary) = comparison @@ -218,7 +219,14 @@ async fn populate_report( return; } - let include_in_triage = deserves_attention_icount(&primary, &secondary); + let include_in_triage = match metric { + Metric::InstructionsUser => deserves_attention_icount(&primary, &secondary), + _ => primary + .largest_change() + .or_else(|| secondary.largest_change()) + .map(|c| c.magnitude() >= Magnitude::Small) + .unwrap_or(false), + }; if include_in_triage { let entry = report.entry(direction).or_default(); diff --git a/triage/README.md b/triage/README.md index e0b3813e1..e6395bd44 100644 --- a/triage/README.md +++ b/triage/README.md @@ -30,6 +30,11 @@ Use the API endpoint to automate building the file: % curl "https://perf.rust-lang.org/perf/triage?start=$PARENT" > YYYY-MM-DD.md ``` +You can also analyze binary size regressions/improvements using the following command: +``` +% curl "https://perf.rust-lang.org/perf/triage?start=$PARENT&metric=size:linked-artifact" > binary-size.md +``` + ## Analysis The following is a list of items you should look for when interpreting performance results.