Skip to content

Commit 357bb2b

Browse files
committed
Move comparison table links to a separate section
1 parent 43d16fe commit 357bb2b

File tree

2 files changed

+105
-76
lines changed

2 files changed

+105
-76
lines changed

site/frontend/src/pages/compare/compile/table/benchmark-detail.vue

Lines changed: 76 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ const props = defineProps<{
1818
testCase: CompileTestCase;
1919
metric: string;
2020
artifact: ArtifactDescription;
21+
baseArtifact: ArtifactDescription;
2122
benchmarkMap: CompileBenchmarkMap;
2223
}>();
2324
@@ -128,6 +129,34 @@ function getGraphTitle() {
128129
}
129130
}
130131
132+
function benchmarkLink(benchmark: string): string {
133+
return `https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/${benchmark}`;
134+
}
135+
136+
function detailedQueryLink(
137+
commit: ArtifactDescription,
138+
baseCommit?: ArtifactDescription
139+
): string {
140+
const {benchmark, profile, scenario} = props.testCase;
141+
let link = `/detailed-query.html?commit=${commit.commit}&benchmark=${benchmark}-${profile}&scenario=${scenario}`;
142+
if (baseCommit !== undefined) {
143+
link += `&base_commit=${baseCommit.commit}`;
144+
}
145+
return link;
146+
}
147+
148+
function graphLink(
149+
commit: ArtifactDescription,
150+
metric: string,
151+
testCase: CompileTestCase
152+
): string {
153+
// Move to `30 days ago` to display history of the test case
154+
const start = getPastDate(new Date(commit.date), 30);
155+
const end = commit.commit;
156+
const {benchmark, profile, scenario} = testCase;
157+
return `/index.html?start=${start}&end=${end}&benchmark=${benchmark}&profile=${profile}&scenario=${scenario}&stat=${metric}`;
158+
}
159+
131160
const metadata = computed(
132161
(): CompileBenchmarkMetadata =>
133162
props.benchmarkMap[props.testCase.benchmark] ?? null
@@ -180,9 +209,8 @@ onMounted(() => renderGraph());
180209
</tr>
181210
<tr v-if="(metadata?.iterations ?? null) !== null">
182211
<td>
183-
Iterations<Tooltip>
184-
How many times is the benchmark executed?
185-
</Tooltip>
212+
Iterations
213+
<Tooltip> How many times is the benchmark executed? </Tooltip>
186214
</td>
187215
<td>{{ metadata.iterations }}</td>
188216
</tr>
@@ -214,6 +242,42 @@ onMounted(() => renderGraph());
214242
</div>
215243
<div ref="chartElement"></div>
216244
</div>
245+
<div class="links">
246+
<div class="title bold">Links</div>
247+
<ul>
248+
<li>
249+
<a
250+
:href="graphLink(props.artifact, props.metric, props.testCase)"
251+
target="_blank"
252+
>
253+
History graph
254+
</a>
255+
</li>
256+
<li>
257+
<a
258+
:href="detailedQueryLink(props.artifact, props.baseArtifact)"
259+
target="_blank"
260+
>
261+
Self profile (diff)
262+
</a>
263+
</li>
264+
<li>
265+
<a :href="detailedQueryLink(props.baseArtifact)" target="_blank">
266+
Self profile (before)
267+
</a>
268+
</li>
269+
<li>
270+
<a :href="detailedQueryLink(props.artifact)" target="_blank">
271+
Self profile (after)
272+
</a>
273+
</li>
274+
<li>
275+
<a :href="benchmarkLink(testCase.benchmark)" target="_blank">
276+
Benchmark source code
277+
</a>
278+
</li>
279+
</ul>
280+
</div>
217281
</div>
218282
</template>
219283

@@ -222,15 +286,18 @@ onMounted(() => renderGraph());
222286
display: flex;
223287
margin: 10px 0;
224288
}
289+
225290
.title {
226291
&.bold,
227292
.bold {
228293
font-weight: bold;
229294
}
295+
230296
&.info {
231297
margin-bottom: 15px;
232298
}
233299
}
300+
234301
table {
235302
align-self: flex-start;
236303
margin-right: 20px;
@@ -244,6 +311,12 @@ table {
244311
}
245312
}
246313
}
314+
315+
.links {
316+
li {
317+
text-align: left;
318+
}
319+
}
247320
</style>
248321

249322
<style>

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

Lines changed: 29 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -20,39 +20,6 @@ const props = defineProps<{
2020
stat: string;
2121
}>();
2222
23-
function benchmarkLink(benchmark: string): string {
24-
return `https://github.com/rust-lang/rustc-perf/tree/master/collector/compile-benchmarks/${benchmark}`;
25-
}
26-
27-
function graphLink(
28-
commit: ArtifactDescription,
29-
stat: string,
30-
comparison: TestCaseComparison<CompileTestCase>
31-
): string {
32-
// Move to `30 days ago` to display history of the test case
33-
const start = getPastDate(new Date(commit.date), 30);
34-
const end = commit.commit;
35-
const {benchmark, profile, scenario} = comparison.testCase;
36-
return `/index.html?start=${start}&end=${end}&benchmark=${benchmark}&profile=${profile}&scenario=${scenario}&stat=${stat}`;
37-
}
38-
39-
function detailedQueryPercentLink(
40-
commit: ArtifactDescription,
41-
baseCommit: ArtifactDescription,
42-
comparison: TestCaseComparison<CompileTestCase>
43-
): string {
44-
const {benchmark, profile, scenario} = comparison.testCase;
45-
return `/detailed-query.html?commit=${commit.commit}&base_commit=${baseCommit.commit}&benchmark=${benchmark}-${profile}&scenario=${scenario}`;
46-
}
47-
48-
function detailedQueryRawDataLink(
49-
commit: ArtifactDescription,
50-
comparison: TestCaseComparison<CompileTestCase>
51-
) {
52-
const {benchmark, profile, scenario} = comparison.testCase;
53-
return `/detailed-query.html?commit=${commit.commit}&benchmark=${benchmark}-${profile}&scenario=${scenario}`;
54-
}
55-
5623
function prettifyRawNumber(number: number): string {
5724
return number.toLocaleString();
5825
}
@@ -85,7 +52,7 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
8552
<table v-else class="benches compare">
8653
<thead>
8754
<tr>
88-
<th class="toggle"></th>
55+
<th class="toggle-arrow"></th>
8956
<th>Benchmark</th>
9057
<th>Profile</th>
9158
<th>Scenario</th>
@@ -118,42 +85,25 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
11885
</thead>
11986
<tbody>
12087
<template v-for="comparison in comparisons">
121-
<tr>
122-
<td @click="toggleExpanded(comparison.testCase)" class="toggle">
88+
<tr
89+
@click="toggleExpanded(comparison.testCase)"
90+
:class="{toggle: true, toggled: isExpanded(comparison.testCase)}"
91+
>
92+
<td class="toggle-arrow">
12393
{{ isExpanded(comparison.testCase) ? "▼" : "▶" }}
12494
</td>
12595
<td>
126-
<a
127-
v-bind:href="benchmarkLink(comparison.testCase.benchmark)"
128-
class="silent-link"
129-
target="_blank"
130-
>
131-
{{ comparison.testCase.benchmark }}
132-
</a>
96+
{{ comparison.testCase.benchmark }}
13397
</td>
13498
<td>
135-
<a
136-
v-bind:href="graphLink(commitB, stat, comparison)"
137-
target="_blank"
138-
class="silent-link"
139-
>
140-
{{ comparison.testCase.profile }}
141-
</a>
99+
{{ comparison.testCase.profile }}
142100
</td>
143101
<td>{{ comparison.testCase.scenario }}</td>
144102
<td>
145103
<div class="numeric-aligned">
146-
<div>
147-
<a
148-
v-bind:href="
149-
detailedQueryPercentLink(commitB, commitA, comparison)
150-
"
151-
>
152-
<span v-bind:class="percentClass(comparison.percent)">
153-
{{ comparison.percent.toFixed(2) }}%
154-
</span>
155-
</a>
156-
</div>
104+
<span v-bind:class="percentClass(comparison.percent)">
105+
{{ comparison.percent.toFixed(2) }}%
106+
</span>
157107
</div>
158108
</td>
159109
<td class="narrow">
@@ -179,24 +129,21 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
179129
</div>
180130
</td>
181131
<td v-if="showRawData" class="numeric">
182-
<a v-bind:href="detailedQueryRawDataLink(commitA, comparison)">
183-
<abbr :title="comparison.datumA.toString()"
184-
>{{ prettifyRawNumber(comparison.datumA) }}{{ unit }}</abbr
185-
>
186-
</a>
132+
<abbr :title="comparison.datumA.toString()">
133+
{{ prettifyRawNumber(comparison.datumA) }}{{ unit }}
134+
</abbr>
187135
</td>
188136
<td v-if="showRawData" class="numeric">
189-
<a v-bind:href="detailedQueryRawDataLink(commitB, comparison)">
190-
<abbr :title="comparison.datumB.toString()"
191-
>{{ prettifyRawNumber(comparison.datumB) }}{{ unit }}</abbr
192-
>
193-
</a>
137+
<abbr :title="comparison.datumB.toString()">
138+
{{ prettifyRawNumber(comparison.datumB) }}{{ unit }}
139+
</abbr>
194140
</td>
195141
</tr>
196142
<tr v-if="isExpanded(comparison.testCase)">
197143
<td :colspan="columnCount">
198144
<BenchmarkDetail
199145
:test-case="comparison.testCase"
146+
:base-artifact="commitA"
200147
:artifact="commitB"
201148
:metric="stat"
202149
:benchmark-map="benchmarkMap"
@@ -214,6 +161,7 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
214161
width: 100%;
215162
table-layout: auto;
216163
font-size: medium;
164+
border-collapse: collapse;
217165
218166
td,
219167
th {
@@ -240,14 +188,22 @@ const {toggleExpanded, isExpanded} = useExpandedStore();
240188
th {
241189
text-align: center;
242190
243-
&.toggle {
191+
&.toggle-arrow {
244192
padding-right: 5px;
245-
cursor: pointer;
246193
}
247194
&.narrow {
248195
max-width: 100px;
249196
}
250197
}
198+
199+
.toggle {
200+
cursor: pointer;
201+
202+
&:hover,
203+
&.toggled {
204+
background-color: #d6d3d35c;
205+
}
206+
}
251207
}
252208
253209
.benches td {

0 commit comments

Comments
 (0)