Skip to content

Commit 463a886

Browse files
committed
Move benchmark extended information to benchmark detail
1 parent 549e298 commit 463a886

File tree

2 files changed

+88
-38
lines changed

2 files changed

+88
-38
lines changed
Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,91 @@
11
<script setup lang="ts">
2-
import {CompileTestCase} from "../common";
2+
import {
3+
CargoProfileMetadata,
4+
CompileBenchmarkMap,
5+
CompileBenchmarkMetadata,
6+
CompileTestCase,
7+
} from "../common";
8+
import {computed} from "vue";
9+
import Tooltip from "../../tooltip.vue";
310
411
const props = defineProps<{
512
testCase: CompileTestCase;
13+
benchmarkMap: CompileBenchmarkMap;
614
}>();
15+
const metadata = computed(
16+
(): CompileBenchmarkMetadata =>
17+
props.benchmarkMap[props.testCase.benchmark] ?? null
18+
);
19+
const cargoProfile = computed((): CargoProfileMetadata => {
20+
if (
21+
props.testCase.profile === "opt" &&
22+
metadata?.value.release_profile !== null
23+
) {
24+
return metadata.value.release_profile;
25+
} else if (
26+
props.testCase.profile === "debug" &&
27+
metadata?.value.dev_profile !== null
28+
) {
29+
return metadata?.value.dev_profile;
30+
}
31+
});
732
</script>
833
<template>
9-
<div>Benchmark detail</div>
34+
<table>
35+
<tbody>
36+
<tr>
37+
<td>Benchmark</td>
38+
<td>{{ testCase.benchmark }}</td>
39+
</tr>
40+
<tr>
41+
<td>Profile</td>
42+
<td>{{ testCase.profile }}</td>
43+
</tr>
44+
<tr>
45+
<td>Scenario</td>
46+
<td>{{ testCase.scenario }}</td>
47+
</tr>
48+
<tr>
49+
<td>Category</td>
50+
<td>{{ testCase.category }}</td>
51+
</tr>
52+
<tr v-if="(metadata?.binary ?? null) !== null">
53+
<td>Artifact</td>
54+
<td>{{ metadata.binary ? "binary" : "library" }}</td>
55+
</tr>
56+
<tr v-if="(metadata?.iterations ?? null) !== null">
57+
<td>
58+
Iterations<Tooltip>
59+
How many times is the benchmark executed?
60+
</Tooltip>
61+
</td>
62+
<td>{{ metadata.iterations }}</td>
63+
</tr>
64+
<tr v-if="(cargoProfile?.lto ?? null) !== null">
65+
<td>LTO</td>
66+
<td>{{ cargoProfile.lto }}</td>
67+
</tr>
68+
<tr v-if="(cargoProfile?.debug ?? null) !== null">
69+
<td>Debuginfo</td>
70+
<td>{{ cargoProfile.debug }}</td>
71+
</tr>
72+
<tr v-if="(cargoProfile?.codegen_units ?? null) !== null">
73+
<td>Codegen units</td>
74+
<td>{{ cargoProfile.codegen_units }}</td>
75+
</tr>
76+
</tbody>
77+
</table>
1078
</template>
79+
80+
<style scoped lang="scss">
81+
table {
82+
td {
83+
text-align: left;
84+
85+
&:first-child {
86+
font-weight: bold;
87+
padding-right: 10px;
88+
}
89+
}
90+
}
91+
</style>

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

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -62,40 +62,6 @@ function prettifyRawNumber(number: number): string {
6262
return number.toLocaleString();
6363
}
6464
65-
function generateBenchmarkTooltip(testCase: CompileTestCase): string {
66-
const metadata = props.benchmarkMap[testCase.benchmark] ?? null;
67-
if (metadata === null) {
68-
return "<No metadata found>";
69-
}
70-
let tooltip = `Benchmark: ${testCase.benchmark}
71-
Category: ${metadata.category}
72-
`;
73-
if (metadata.binary !== null) {
74-
tooltip += `Artifact: ${metadata.binary ? "binary" : "library"}\n`;
75-
}
76-
if (metadata.iterations !== null) {
77-
tooltip += `Iterations: ${metadata.iterations}\n`;
78-
}
79-
const addMetadata = ({lto, debug, codegen_units}) => {
80-
if (lto !== null) {
81-
tooltip += `LTO: ${lto}\n`;
82-
}
83-
if (debug !== null) {
84-
tooltip += `Debuginfo: ${debug}\n`;
85-
}
86-
if (codegen_units !== null) {
87-
tooltip += `Codegen units: ${codegen_units}\n`;
88-
}
89-
};
90-
if (testCase.profile === "opt" && metadata.release_profile !== null) {
91-
addMetadata(metadata.release_profile);
92-
} else if (testCase.profile === "debug" && metadata.dev_profile !== null) {
93-
addMetadata(metadata.dev_profile);
94-
}
95-
96-
return tooltip;
97-
}
98-
9965
const columnCount = computed(() => {
10066
const base = 7;
10167
if (props.showRawData) {
@@ -161,7 +127,7 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
161127
<td @click="toggleExpanded(comparison.testCase)">
162128
{{ isExpanded(comparison.testCase) ? "▼" : "▶" }}
163129
</td>
164-
<td :title="generateBenchmarkTooltip(comparison.testCase)">
130+
<td>
165131
<a
166132
v-bind:href="benchmarkLink(comparison.testCase.benchmark)"
167133
class="silent-link"
@@ -234,7 +200,10 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
234200
</tr>
235201
<tr v-if="isExpanded(comparison.testCase)">
236202
<td :colspan="columnCount">
237-
<BenchmarkDetail :test-case="comparison.testCase" />
203+
<BenchmarkDetail
204+
:test-case="comparison.testCase"
205+
:benchmark-map="benchmarkMap"
206+
/>
238207
</td>
239208
</tr>
240209
</template>

0 commit comments

Comments
 (0)