Skip to content

Commit 7b480f5

Browse files
committed
Display more compile benchmark metadata in the compare dashboard
1 parent 7d09861 commit 7b480f5

File tree

8 files changed

+61
-4
lines changed

8 files changed

+61
-4
lines changed

collector/src/compile/benchmark/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ impl BenchmarkConfig {
7272
pub fn artifact(&self) -> ArtifactType {
7373
self.artifact
7474
}
75+
76+
pub fn iterations(&self) -> usize {
77+
self.runs
78+
}
7579
}
7680

7781
#[derive(Ord, PartialOrd, Eq, PartialEq, Clone, Hash)]

site/frontend/src/pages/compare/compile/benchmarks.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,17 @@ import {computed, h} from "vue";
33
import ComparisonsTable from "./comparisons-table.vue";
44
import {TestCaseComparison} from "../data";
55
import {CompareResponse} from "../types";
6-
import {CompileBenchmarkFilter, CompileTestCase} from "./common";
6+
import {
7+
CompileBenchmarkFilter,
8+
CompileBenchmarkMap,
9+
CompileTestCase,
10+
} from "./common";
711
812
export interface BenchmarkProps {
913
data: CompareResponse;
1014
testCases: TestCaseComparison<CompileTestCase>[];
1115
allTestCases: TestCaseComparison<CompileTestCase>[];
16+
benchmarkMap: CompileBenchmarkMap;
1217
filter: CompileBenchmarkFilter;
1318
stat: string;
1419
}
@@ -71,6 +76,7 @@ const secondaryHasNonRelevant = computed(
7176
:commit-a="data.a"
7277
:commit-b="data.b"
7378
:stat="stat"
79+
:benchmark-map="benchmarkMap"
7480
>
7581
<template #header>
7682
<Section title="Primary" link="secondary" :linkUp="false"></Section>
@@ -85,6 +91,7 @@ const secondaryHasNonRelevant = computed(
8591
:commit-a="data.a"
8692
:commit-b="data.b"
8793
:stat="stat"
94+
:benchmark-map="benchmarkMap"
8895
>
8996
<template #header>
9097
<Section title="Secondary" link="primary" :linkUp="true"></Section>

site/frontend/src/pages/compare/compile/common.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,18 @@ export type Category = "primary" | "secondary";
5454

5555
export type CompileBenchmarkMap = Dict<CompileBenchmarkMetadata>;
5656

57+
export interface CargoProfileMetadata {
58+
debug: string | null;
59+
lto: string | null;
60+
codegen_units: number | null;
61+
}
62+
5763
export interface CompileBenchmarkMetadata {
5864
name: string;
5965
category: Category;
6066
binary: boolean | null;
67+
iterations: number | null;
68+
release_profile: CargoProfileMetadata;
6169
}
6270

6371
export interface CompileBenchmarkComparison {

site/frontend/src/pages/compare/compile/comparisons-table.vue

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ import {TestCaseComparison} from "../data";
33
import Tooltip from "../tooltip.vue";
44
import {ArtifactDescription} from "../types";
55
import {percentClass} from "../shared";
6-
import {CompileTestCase} from "./common";
6+
import {CompileBenchmarkMap, CompileTestCase} from "./common";
77
88
const props = defineProps<{
99
id: string;
1010
comparisons: TestCaseComparison<CompileTestCase>[];
11+
benchmarkMap: CompileBenchmarkMap;
1112
hasNonRelevant: boolean;
1213
showRawData: boolean;
1314
commitA: ArtifactDescription;
@@ -57,6 +58,36 @@ function detailedQueryRawDataLink(
5758
function prettifyRawNumber(number: number): string {
5859
return number.toLocaleString();
5960
}
61+
62+
function generateBenchmarkTooltip(testCase: CompileTestCase): string {
63+
const metadata = props.benchmarkMap[testCase.benchmark] ?? null;
64+
if (metadata === null) {
65+
return "<No metadata found>";
66+
}
67+
let tooltip = `Benchmark: ${testCase.benchmark}
68+
Category: ${metadata.category}
69+
`;
70+
if (metadata.binary !== null) {
71+
tooltip += `Artifact: ${metadata.binary ? "binary" : "library"}\n`;
72+
}
73+
if (metadata.iterations !== null) {
74+
tooltip += `Iterations: ${metadata.iterations}\n`;
75+
}
76+
if (testCase.profile === "opt" && metadata.release_profile !== null) {
77+
const {lto, debug, codegen_units} = metadata.release_profile;
78+
if (lto !== null) {
79+
tooltip += `LTO: ${lto}\n`;
80+
}
81+
if (debug !== null) {
82+
tooltip += `Debuginfo: ${debug}\n`;
83+
}
84+
if (codegen_units !== null) {
85+
tooltip += `Codegen units: ${codegen_units}\n`;
86+
}
87+
}
88+
89+
return tooltip;
90+
}
6091
</script>
6192

6293
<template>
@@ -101,7 +132,7 @@ function prettifyRawNumber(number: number): string {
101132
<tbody>
102133
<template v-for="comparison in comparisons">
103134
<tr>
104-
<td>
135+
<td :title="generateBenchmarkTooltip(comparison.testCase)">
105136
<a
106137
v-bind:href="benchmarkLink(comparison.testCase.benchmark)"
107138
class="silent-link"

site/frontend/src/pages/compare/compile/compile-page.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,5 +184,6 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
184184
:all-test-cases="allComparisons"
185185
:filter="filter"
186186
:stat="selector.stat"
187+
:benchmark-map="benchmarkMap"
187188
></Benchmarks>
188189
</template>

site/src/api.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ pub mod bootstrap {
131131
}
132132

133133
pub mod comparison {
134+
use crate::benchmark_metadata::ProfileMetadata;
134135
use crate::comparison::Metric;
135136
use collector::Bound;
136137
use database::Date;
@@ -153,6 +154,8 @@ pub mod comparison {
153154
// benchmark, the metadata for it will no longer be available, so we might not always have
154155
// access to the metadata.
155156
pub binary: Option<bool>,
157+
pub iterations: Option<u32>,
158+
pub release_profile: Option<ProfileMetadata>,
156159
}
157160

158161
#[derive(Debug, Clone, Serialize)]

site/src/benchmark_metadata/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,10 @@ use rust_embed::RustEmbed;
44
use collector::compile::benchmark::category::Category;
55
use collector::compile::benchmark::BenchmarkConfig;
66

7-
use crate::benchmark_metadata::metadata::{ProfileMetadata, SERIALIZED_SUITE_NAME};
7+
use crate::benchmark_metadata::metadata::SERIALIZED_SUITE_NAME;
88

99
mod metadata;
10+
pub use metadata::ProfileMetadata;
1011

1112
#[derive(Debug, Clone)]
1213
pub struct CompileBenchmarkMetadata {

site/src/comparison.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,8 @@ pub async fn handle_compare(
183183
name,
184184
category,
185185
binary: metadata.map(|m| m.perf_config.artifact() == ArtifactType::Binary),
186+
iterations: metadata.map(|m| m.perf_config.iterations() as u32),
187+
release_profile: metadata.map(|m| m.release_metadata.clone()),
186188
}
187189
})
188190
.collect();

0 commit comments

Comments
 (0)