Skip to content

Commit

Permalink
Merge pull request #1787 from Kobzol/triage-metric
Browse files Browse the repository at this point in the history
Allow creating triage report for arbitrary metric
  • Loading branch information
Kobzol authored Dec 26, 2023
2 parents 1428985 + 7797837 commit 9b20563
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
3 changes: 3 additions & 0 deletions site/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ pub mod github {
}

pub mod triage {
use crate::comparison::Metric;
use collector::Bound;
use serde::{Deserialize, Serialize};

Expand All @@ -577,6 +578,8 @@ pub mod triage {
pub start: Bound,
#[serde(default)]
pub end: Bound,
#[serde(default)]
pub metric: Option<Metric>,
}

#[derive(Debug, Clone, Serialize, Deserialize)]
Expand Down
14 changes: 11 additions & 3 deletions site/src/comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand Down Expand Up @@ -207,6 +207,7 @@ pub async fn handle_compare(
async fn populate_report(
comparison: &ArtifactComparison,
benchmark_map: &HashMap<Benchmark, Category>,
metric: Metric,
report: &mut HashMap<Direction, Vec<String>>,
) {
let (primary, secondary) = comparison
Expand All @@ -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();
Expand Down
5 changes: 5 additions & 0 deletions triage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 9b20563

Please sign in to comment.