Skip to content

Commit e1a4f14

Browse files
committed
Add summary
1 parent 13551c7 commit e1a4f14

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

site/static/compare.html

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,31 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
341341
</div>
342342
</fieldset>
343343
<div v-if="data" id="content" style="margin-top: 15px">
344+
<div>
345+
<span style="font-weight: bold;">Summary:</span>
346+
<span class="positive">
347+
{{summary.numRegressed}}
348+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
349+
<path
350+
d="M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z">
351+
</path>
352+
</svg>
353+
</span>
354+
<span>
355+
{{summary.numUnchanged}}
356+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
357+
<path d="M22,12L18,8V11H3V13H18V16L22,12Z"></path>
358+
</svg>
359+
</span>
360+
<span class="negative">
361+
{{summary.numImproved}}
362+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
363+
<path
364+
d="M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z">
365+
</path>
366+
</svg>
367+
</span>
368+
</div>
344369
<table id="benches" class="compare">
345370
<template v-for="bench in benches">
346371
<tbody>
@@ -572,6 +597,37 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
572597
},
573598
stat() {
574599
return findQueryParam("stat") || "instructions:u";
600+
},
601+
summary() {
602+
let numRegressed = 0;
603+
let numImproved = 0;
604+
let numUnchanged = 0;
605+
for (let name of Object.keys(this.data.a.data)) {
606+
for (let d of this.data.a.data[name]) {
607+
const run = d[0];
608+
const datumA = d[1];
609+
const datumB = this.data.b.data[name]?.find(x => x[0] == run)?.[1];
610+
if (!datumB) {
611+
continue;
612+
}
613+
let percent = 100 * ((datumB - datumA) / datumA);
614+
const isDodgy = this.isDodgy(name, run);
615+
const threshold = isDodgy ? 1.0 : 0.2;
616+
if (percent > threshold) {
617+
numRegressed += 1;
618+
} else if (percent < -threshold) {
619+
numImproved += 1;
620+
} else {
621+
numUnchanged += 1
622+
}
623+
}
624+
}
625+
return {
626+
numRegressed,
627+
numImproved,
628+
numUnchanged,
629+
}
630+
575631
}
576632
},
577633
methods: {
@@ -620,6 +676,14 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
620676
}
621677
return result;
622678
},
679+
isDodgy(name, run) {
680+
let variance = this.data.variance;
681+
if (!variance) {
682+
return false;
683+
}
684+
variance = this.data.variance[name + "-" + run];
685+
return (variance?.description?.type ?? "Normal") != "Normal";
686+
}
623687
},
624688
});
625689

0 commit comments

Comments
 (0)