Skip to content

Commit 549e298

Browse files
committed
Show benchmark detail on comparison table row click
1 parent 2e60f9b commit 549e298

File tree

3 files changed

+54
-0
lines changed

3 files changed

+54
-0
lines changed
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<script setup lang="ts">
2+
import {CompileTestCase} from "../common";
3+
4+
const props = defineProps<{
5+
testCase: CompileTestCase;
6+
}>();
7+
</script>
8+
<template>
9+
<div>Benchmark detail</div>
10+
</template>

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {ArtifactDescription} from "../../types";
55
import {percentClass} from "../../shared";
66
import {CompileBenchmarkMap, CompileTestCase} from "../common";
77
import {computed} from "vue";
8+
import {useExpandedStore} from "./expansion";
9+
import BenchmarkDetail from "./benchmark-detail.vue";
810
911
const props = defineProps<{
1012
id: string;
@@ -94,6 +96,13 @@ Category: ${metadata.category}
9496
return tooltip;
9597
}
9698
99+
const columnCount = computed(() => {
100+
const base = 7;
101+
if (props.showRawData) {
102+
return base + 2;
103+
}
104+
return base;
105+
});
97106
const unit = computed(() => {
98107
// The DB stored wall-time data in seconds for compile benchmarks, so it is
99108
// hardcoded here
@@ -103,6 +112,7 @@ const unit = computed(() => {
103112
return null;
104113
}
105114
});
115+
const {toggleExpanded, isExpanded} = useExpandedStore();
106116
</script>
107117

108118
<template>
@@ -114,6 +124,7 @@ const unit = computed(() => {
114124
<table v-else class="benches compare">
115125
<thead>
116126
<tr>
127+
<th></th>
117128
<th>Benchmark</th>
118129
<th>Profile</th>
119130
<th>Scenario</th>
@@ -147,6 +158,9 @@ const unit = computed(() => {
147158
<tbody>
148159
<template v-for="comparison in comparisons">
149160
<tr>
161+
<td @click="toggleExpanded(comparison.testCase)">
162+
{{ isExpanded(comparison.testCase) ? "▼" : "▶" }}
163+
</td>
150164
<td :title="generateBenchmarkTooltip(comparison.testCase)">
151165
<a
152166
v-bind:href="benchmarkLink(comparison.testCase.benchmark)"
@@ -218,6 +232,11 @@ const unit = computed(() => {
218232
</a>
219233
</td>
220234
</tr>
235+
<tr v-if="isExpanded(comparison.testCase)">
236+
<td :colspan="columnCount">
237+
<BenchmarkDetail :test-case="comparison.testCase" />
238+
</td>
239+
</tr>
221240
</template>
222241
</tbody>
223242
</table>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import {ref} from "vue";
2+
import {CompileTestCase} from "../common";
3+
4+
export function useExpandedStore() {
5+
const expanded = ref(new Set());
6+
7+
function isExpanded(testCase: CompileTestCase) {
8+
return expanded.value.has(testCaseKey(testCase));
9+
}
10+
11+
function toggleExpanded(testCase: CompileTestCase) {
12+
const key = testCaseKey(testCase);
13+
if (isExpanded(testCase)) {
14+
expanded.value.delete(key);
15+
} else {
16+
expanded.value.add(key);
17+
}
18+
}
19+
20+
return {toggleExpanded, isExpanded};
21+
}
22+
23+
function testCaseKey(testCase: CompileTestCase): string {
24+
return `${testCase.benchmark};${testCase.profile};${testCase.scenario};${testCase.category}`;
25+
}

0 commit comments

Comments
 (0)