Skip to content

Commit e31c217

Browse files
authored
Merge pull request #2209 from Kobzol/compare-changes-filter
Add changes filter to compare page
2 parents a0cdd32 + e8a8762 commit e31c217

File tree

3 files changed

+68
-0
lines changed

3 files changed

+68
-0
lines changed

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export type CompileBenchmarkFilter = {
2727
binary: boolean;
2828
library: boolean;
2929
};
30+
changes: {
31+
regressions: boolean;
32+
improvements: boolean;
33+
};
3034
selfCompareBackend: boolean;
3135
} & BenchmarkFilter;
3236

@@ -58,6 +62,10 @@ export const defaultCompileFilter: CompileBenchmarkFilter = {
5862
binary: true,
5963
library: true,
6064
},
65+
changes: {
66+
regressions: true,
67+
improvements: true,
68+
},
6169
selfCompareBackend: false,
6270
};
6371

@@ -154,6 +162,16 @@ export function computeCompileComparisonsWithNonRelevant(
154162
return true;
155163
}
156164

165+
function changeFilter(
166+
comparison: TestCaseComparison<CompileTestCase>
167+
): boolean {
168+
const isImprovement = comparison.percent <= 0.0;
169+
if (isImprovement && !filter.changes.improvements) return false;
170+
if (!isImprovement && !filter.changes.regressions) return false;
171+
172+
return true;
173+
}
174+
157175
function categoryFilter(category: Category) {
158176
if (category === "primary" && !filter.category.primary) return false;
159177
if (category === "secondary" && !filter.category.secondary) return false;
@@ -167,6 +185,7 @@ export function computeCompileComparisonsWithNonRelevant(
167185
backendFilter(comparison.testCase.backend) &&
168186
categoryFilter(comparison.testCase.category) &&
169187
artifactFilter(benchmarkMap[comparison.testCase.benchmark] ?? null) &&
188+
changeFilter(comparison) &&
170189
benchmarkNameMatchesFilter(comparison.testCase.benchmark, filter.name)
171190
);
172191
}

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,18 @@ function loadFilterFromUrl(
102102
defaultFilter.artifact.library
103103
),
104104
},
105+
changes: {
106+
regressions: getBoolOrDefault(
107+
urlParams,
108+
"regressions",
109+
defaultFilter.changes.regressions
110+
),
111+
improvements: getBoolOrDefault(
112+
urlParams,
113+
"improvements",
114+
defaultCompileFilter.changes.improvements
115+
),
116+
},
105117
selfCompareBackend: getBoolOrDefault(
106118
urlParams,
107119
"selfCompareBackend",
@@ -178,6 +190,16 @@ function storeFilterToUrl(
178190
filter.artifact.library,
179191
defaultFilter.artifact.library
180192
);
193+
storeOrReset(
194+
"regressions",
195+
filter.changes.regressions,
196+
defaultFilter.changes.regressions
197+
);
198+
storeOrReset(
199+
"improvements",
200+
filter.changes.improvements,
201+
defaultFilter.changes.improvements
202+
);
181203
storeOrReset(
182204
"selfCompareBackend",
183205
filter.selfCompareBackend,

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

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,33 @@ const opened = createPersistedRef(PREF_FILTERS_OPENED);
259259
</li>
260260
</ul>
261261
</div>
262+
<div class="section section-list-wrapper">
263+
<div class="section-heading">
264+
<div style="width: 160px">
265+
<span>Changes</span>
266+
<Tooltip>
267+
Select only improvements, only regressions, or both.
268+
</Tooltip>
269+
</div>
270+
</div>
271+
<ul class="states-list">
272+
<li>
273+
<label>
274+
<input type="checkbox" v-model="filter.changes.regressions" />
275+
<span class="label">regressions</span>
276+
</label>
277+
</li>
278+
<li>
279+
<label>
280+
<input
281+
type="checkbox"
282+
v-model="filter.changes.improvements"
283+
/>
284+
<span class="label">improvements</span>
285+
</label>
286+
</li>
287+
</ul>
288+
</div>
262289
<div class="section">
263290
<div class="section-heading">
264291
<span>Show non-relevant results</span>

0 commit comments

Comments
 (0)