Skip to content

Commit fdc50f5

Browse files
authored
Merge pull request #927 from rylev/summary
Add summary
2 parents 57ff364 + 512d476 commit fdc50f5

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

site/static/compare.html

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@
203203
.benchmark-name {
204204
text-align: center;
205205
}
206+
207+
.summary {
208+
display: flex;
209+
align-items: center;
210+
}
206211
</style>
207212
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
208213
</head>
@@ -341,6 +346,31 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
341346
</div>
342347
</fieldset>
343348
<div v-if="data" id="content" style="margin-top: 15px">
349+
<div style="display: flex; justify-content: space-evenly;">
350+
<span style="font-weight: bold;">Summary:</span>
351+
<span class="summary positive">
352+
{{summary.numRegressed}}
353+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
354+
<path
355+
d="M16,18L18.29,15.71L13.41,10.83L9.41,14.83L2,7.41L3.41,6L9.41,12L13.41,8L19.71,14.29L22,12V18H16Z">
356+
</path>
357+
</svg>
358+
</span>
359+
<span class="summary">
360+
{{summary.numUnchanged}}
361+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
362+
<path d="M22,12L18,8V11H3V13H18V16L22,12Z"></path>
363+
</svg>
364+
</span>
365+
<span class="summary negative">
366+
{{summary.numImproved}}
367+
<svg style="width:18px;height:18px" viewBox="0 0 24 24">
368+
<path
369+
d="M16,6L18.29,8.29L13.41,13.17L9.41,9.17L2,16.59L3.41,18L9.41,12L13.41,16L19.71,9.71L22,12V6H16Z">
370+
</path>
371+
</svg>
372+
</span>
373+
</div>
344374
<table id="benches" class="compare">
345375
<template v-for="bench in benches">
346376
<tbody>
@@ -572,6 +602,37 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
572602
},
573603
stat() {
574604
return findQueryParam("stat") || "instructions:u";
605+
},
606+
summary() {
607+
let numRegressed = 0;
608+
let numImproved = 0;
609+
let numUnchanged = 0;
610+
for (let name of Object.keys(this.data.a.data)) {
611+
for (let d of this.data.a.data[name]) {
612+
const run = d[0];
613+
const datumA = d[1];
614+
const datumB = this.data.b.data[name]?.find(x => x[0] == run)?.[1];
615+
if (!datumB) {
616+
continue;
617+
}
618+
let percent = 100 * ((datumB - datumA) / datumA);
619+
const isDodgy = this.isDodgy(name, run);
620+
const threshold = isDodgy ? 1.0 : 0.2;
621+
if (percent > threshold) {
622+
numRegressed += 1;
623+
} else if (percent < -threshold) {
624+
numImproved += 1;
625+
} else {
626+
numUnchanged += 1
627+
}
628+
}
629+
}
630+
return {
631+
numRegressed,
632+
numImproved,
633+
numUnchanged,
634+
}
635+
575636
}
576637
},
577638
methods: {
@@ -620,6 +681,14 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
620681
}
621682
return result;
622683
},
684+
isDodgy(name, run) {
685+
let variance = this.data.variance;
686+
if (!variance) {
687+
return false;
688+
}
689+
variance = this.data.variance[name + "-" + run];
690+
return (variance?.description?.type ?? "Normal") != "Normal";
691+
}
623692
},
624693
});
625694

0 commit comments

Comments
 (0)