Skip to content

Commit 755f62c

Browse files
authored
Merge pull request #1878 from Kobzol/benchmark-detail-relative-chart
Use "percent from first" graph in benchmark detail
2 parents 9bad799 + e7181da commit 755f62c

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

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

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ function createGraphsSelector(): CompileDetailGraphsSelector {
130130
stat: props.metric,
131131
start,
132132
end,
133-
kinds: ["percentrelative", "raw"] as GraphKind[],
133+
kinds: ["percentrelative", "percentfromfirst"] as GraphKind[],
134134
};
135135
}
136136
@@ -193,7 +193,10 @@ async function renderGraphs(detail: CompileDetailGraphs) {
193193
0,
194194
"percentrelative"
195195
);
196-
const [rawData, rawSelector] = buildGraph(1, "raw");
196+
const [percentFromFirstData, percentFromFirstSelector] = buildGraph(
197+
1,
198+
"percentfromfirst"
199+
);
197200
198201
// We want to be able to see noise "blips" vs. a previous artifact.
199202
// The "percent relative from previous commit" graph should be the best to
@@ -202,11 +205,18 @@ async function renderGraphs(detail: CompileDetailGraphs) {
202205
percentRelativeData,
203206
percentRelativeSelector,
204207
date,
205-
relativeChartElement
208+
relativeToPreviousChartElement
206209
);
207210
// We also want to see whether a change maintained its value or whether it was noise and has since
208-
// returned to steady state. Here, an absolute graph ("raw") is best.
209-
renderGraph(rawData, rawSelector, date, absoluteChartElement);
211+
// returned to steady state. Here, an absolute graph ("raw") would be best, however small changes
212+
// are hard to observe in it. Therefore, we use "percent from first commit" graph instead, which
213+
// is essentialy a "zoomed-in" version of the raw graph.
214+
renderGraph(
215+
percentFromFirstData,
216+
percentFromFirstSelector,
217+
date,
218+
relativeToFirstChartElement
219+
);
210220
}
211221
212222
async function renderGraph(
@@ -284,8 +294,8 @@ const cargoProfile = computed((): CargoProfileMetadata => {
284294
}
285295
});
286296
287-
const relativeChartElement: Ref<HTMLElement | null> = ref(null);
288-
const absoluteChartElement: Ref<HTMLElement | null> = ref(null);
297+
const relativeToPreviousChartElement: Ref<HTMLElement | null> = ref(null);
298+
const relativeToFirstChartElement: Ref<HTMLElement | null> = ref(null);
289299
const graphRange = computed(() =>
290300
getGraphRange(props.artifact, props.baseArtifact)
291301
);
@@ -402,14 +412,15 @@ onMounted(() => {
402412
<div class="title">
403413
<div class="bold">{{ getGraphTitle() }}</div>
404414
<div style="font-size: 0.8em">
405-
Plot of the absolute values of the current metric
415+
Each plotted value is relative to the first commit of the commit
416+
range
406417
</div>
407418
<div style="font-size: 0.8em">
408419
The shaded region shows values that are more recent than the
409420
benchmarked commit
410421
</div>
411422
</div>
412-
<div ref="absoluteChartElement"></div>
423+
<div ref="relativeToFirstChartElement"></div>
413424
</div>
414425
<div class="rows center-items grow">
415426
<div class="title">
@@ -422,7 +433,7 @@ onMounted(() => {
422433
benchmarked commit
423434
</div>
424435
</div>
425-
<div ref="relativeChartElement"></div>
436+
<div ref="relativeToPreviousChartElement"></div>
426437
</div>
427438
</div>
428439
<div class="columns" v-if="props.metric !== BINARY_SIZE_METRIC">

0 commit comments

Comments
 (0)