Skip to content

Commit 059fcda

Browse files
committed
Display geometric mean of benchmarks in compare site
1 parent 972df18 commit 059fcda

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

site/static/compare.html

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
419419
</span>
420420
</div>
421421
</div>
422+
<div class="section">
423+
<span style="font-weight: bold; width: 30%; margin-left: 15%;">Geometric mean</span>
424+
<span v-bind:class="percentClass(geoMean)">{{ geoMean.toFixed(2) }}%</span>
425+
</div>
422426
</div>
423427
<table id="benches" class="compare">
424428
<tbody>
@@ -703,6 +707,21 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
703707
stat() {
704708
return findQueryParam("stat") || "instructions:u";
705709
},
710+
geoMean() {
711+
if (this.data === null) {
712+
return "N/A";
713+
}
714+
715+
let geomean = 1;
716+
for (let d of this.data.comparisons) {
717+
const datumA = d.statistics[0];
718+
const datumB = d.statistics[1];
719+
const percent = 100 * ((datumB - datumA) / datumA);
720+
geomean *= percent + 100;
721+
}
722+
geomean = Math.pow(geomean, 1.0 / this.data.comparisons.length);
723+
return geomean - 100;
724+
},
706725
summary() {
707726
// Create object with each test case that is not filtered out as a key
708727
const filtered = Object.fromEntries(this.benches.flatMap(b => b.testCases.map(v => [b.name + "-" + v.scenario, true])));

0 commit comments

Comments
 (0)