Skip to content

Commit 915e095

Browse files
committed
Apply review comments
1 parent e20f90b commit 915e095

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -245,13 +245,12 @@ export function transformDataForBackendComparison(
245245
}
246246
}
247247

248-
const transformed = [];
249-
benchmarkMap.forEach((entry) => {
248+
return Array.from(benchmarkMap, ([_, entry]) => {
250249
const comparison: CompileBenchmarkComparison = {
251250
benchmark: entry.benchmark,
252251
profile: entry.profile,
253252
scenario: entry.scenario,
254-
// Treat the backend as LLVM
253+
// Treat LLVM as the baseline
255254
backend: "llvm",
256255
comparison: {
257256
statistics: [entry.llvm, entry.cranelift],
@@ -260,8 +259,6 @@ export function transformDataForBackendComparison(
260259
significance_threshold: 1.0,
261260
},
262261
};
263-
transformed.push(comparison);
262+
return comparison;
264263
});
265-
266-
return transformed;
267264
}

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

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,22 +216,28 @@ const quickLinksKey = ref(0);
216216
const filter = ref(loadFilterFromUrl(urlParams, defaultCompileFilter));
217217
218218
// Should we use the backend as the source of before/after data?
219-
const selfCompareBackend = computed(
220-
() => comparesIdenticalCommits.value && filter.value.selfCompareBackend
221-
);
219+
const selfCompareBackend = computed(() => {
220+
const hasMultipleBackends =
221+
new Set(props.data.compile_comparisons.map((c) => c.backend)).size > 1;
222+
return (
223+
comparesIdenticalCommits.value &&
224+
filter.value.selfCompareBackend &&
225+
hasMultipleBackends
226+
);
227+
});
222228
223229
function exportData() {
224230
exportToMarkdown(comparisons.value, filter.value.showRawData);
225231
}
226232
227-
// Are we currently comparing the same commit against each other?
233+
// Are we currently comparing the same commit in the before/after toolchains?
228234
const comparesIdenticalCommits = computed(() => {
229235
return props.data.a.commit === props.data.b.commit;
230236
});
231237
const benchmarkMap = createCompileBenchmarkMap(props.data);
232238
233-
// Artificially restructure the data to create a comparison between backends
234239
const compileComparisons = computed(() => {
240+
// If requested, artificially restructure the data to create a comparison between backends
235241
if (selfCompareBackend.value) {
236242
return transformDataForBackendComparison(props.data.compile_comparisons);
237243
} else {
@@ -258,8 +264,11 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
258264
:selected-metric="selector.stat"
259265
:metrics="benchmarkInfo.compile_metrics"
260266
/>
261-
<div v-if="comparesIdenticalCommits">
262-
Self-compare backend:
267+
<div
268+
v-if="comparesIdenticalCommits"
269+
:title="`Compare codegen backends for commit '${props.data.a.commit}'`"
270+
>
271+
Compare codegen backends for this commit:
263272
<input
264273
type="checkbox"
265274
:checked="selfCompareBackend"
@@ -275,7 +284,8 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
275284
<OverallSummary :summary="filteredSummary" />
276285
<Aggregations :cases="comparisons" />
277286
<div class="warning" v-if="selfCompareBackend">
278-
Comparing Cranelift against LLVM baseline!
287+
Note: comparing results of the baseline LLVM backend to the Cranelift
288+
backend.
279289
</div>
280290
<Benchmarks
281291
:data="data"

0 commit comments

Comments
 (0)