Skip to content

Commit 9b2d3fb

Browse files
committed
Store self compare backend checkbox in URL
1 parent cd5b340 commit 9b2d3fb

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export type CompileBenchmarkFilter = {
2727
binary: boolean;
2828
library: boolean;
2929
};
30+
selfCompareBackend: boolean;
3031
} & BenchmarkFilter;
3132

3233
export const defaultCompileFilter: CompileBenchmarkFilter = {
@@ -57,6 +58,7 @@ export const defaultCompileFilter: CompileBenchmarkFilter = {
5758
binary: true,
5859
library: true,
5960
},
61+
selfCompareBackend: false,
6062
};
6163

6264
export type Profile = "check" | "debug" | "opt" | "doc";

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

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,11 @@ function loadFilterFromUrl(
102102
defaultFilter.artifact.library
103103
),
104104
},
105+
selfCompareBackend: getBoolOrDefault(
106+
urlParams,
107+
"selfCompareBackend",
108+
defaultFilter.selfCompareBackend
109+
),
105110
};
106111
}
107112
@@ -173,6 +178,11 @@ function storeFilterToUrl(
173178
filter.artifact.library,
174179
defaultFilter.artifact.library
175180
);
181+
storeOrReset(
182+
"selfCompareBackend",
183+
filter.selfCompareBackend,
184+
defaultFilter.selfCompareBackend
185+
);
176186
177187
changeUrl(urlParams);
178188
}
@@ -183,6 +193,10 @@ function updateFilter(newFilter: CompileBenchmarkFilter) {
183193
refreshQuickLinks();
184194
}
185195
196+
function updateSelfCompareBackend(value: boolean) {
197+
updateFilter({...filter.value, selfCompareBackend: value});
198+
}
199+
186200
/**
187201
* When the filter changes, the URL is updated.
188202
* After that happens, we want to re-render the quick links component, because
@@ -199,7 +213,9 @@ const quickLinksKey = ref(0);
199213
const filter = ref(loadFilterFromUrl(urlParams, defaultCompileFilter));
200214
201215
// Should we use the backend as the source of before/after data?
202-
const selfCompareBackend = ref(false);
216+
const selfCompareBackend = computed(
217+
() => comparesIdenticalCommits.value && filter.value.selfCompareBackend
218+
);
203219
204220
function exportData() {
205221
exportToMarkdown(comparisons.value, filter.value.showRawData);
@@ -240,7 +256,12 @@ const filteredSummary = computed(() => computeSummary(comparisons.value));
240256
:metrics="benchmarkInfo.compile_metrics"
241257
/>
242258
<div v-if="comparesIdenticalCommits">
243-
Self-compare backend: <input type="checkbox" v-model="selfCompareBackend" />
259+
Self-compare backend:
260+
<input
261+
type="checkbox"
262+
:checked="selfCompareBackend"
263+
@change="(e) => updateSelfCompareBackend(e.target.checked)"
264+
/>
244265
</div>
245266
<Filters
246267
:defaultFilter="defaultCompileFilter"

0 commit comments

Comments
 (0)