Skip to content

Commit 89da799

Browse files
committed
Only show 'significant' changes
1 parent d95009b commit 89da799

File tree

1 file changed

+50
-30
lines changed

1 file changed

+50
-30
lines changed

site/static/compare.html

Lines changed: 50 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
.section {
2323
display: flex;
24-
margin: 4px 0;
24+
margin: 10px 0;
2525
}
2626

2727
#commits {
@@ -62,12 +62,6 @@
6262
font-size: 16px;
6363
}
6464

65-
.section .section-heading {
66-
display: flex;
67-
flex-direction: column;
68-
justify-content: center;
69-
}
70-
7165
#filters-content .section-heading {
7266
font-size: 16px;
7367
}
@@ -85,7 +79,6 @@
8579

8680
input {
8781
border-radius: 5px;
88-
padding: 4px;
8982
font-size: 12px;
9083
height: 100%;
9184
}
@@ -98,7 +91,6 @@
9891
width: 100%;
9992
font-weight: bold;
10093
background: #ADD8E6;
101-
margin: 10px 0;
10294
}
10395

10496
.cache-label {
@@ -194,15 +186,15 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
194186
<div class="section">
195187
<div class="section-heading">Filter by benchmark
196188
</div>
197-
<input id="filter" type="text" v-model="filter.name" /> </p>
189+
<input id="filter" type="text" v-model="filter.name" />
198190
</div>
199191
<div class=" section">
200192
<div class="section-heading">
201-
<div>
193+
<div style="width: 160px;">
202194
<span>Cache states</span>
203-
<div class="tooltip">?<span class="tooltiptext">
204-
Most benchmarks have at least 4 cache states for which we collect data
205-
</div>
195+
<span class="tooltip">?<span class="tooltiptext">
196+
Most benchmarks have at least 4 cache states for which we collect data</span>
197+
</span>
206198
</div>
207199
</div>
208200
<ul id="states-list">
@@ -239,6 +231,16 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
239231
</li>
240232
</ul>
241233
</div>
234+
<div class="section">
235+
<div class="section-heading"><span>Show only significant changes</span>
236+
<span class="tooltip">?
237+
<span class="tooltiptext">
238+
Whether to filter out all benchmarks that do not show significant changes.
239+
</span>
240+
</span>
241+
</div>
242+
<input type="checkbox" v-model="filter.showOnlySignificant" style="margin-left: 20px;" />
243+
</div>
242244
</div>
243245
</fieldset>
244246
<div id="content" style="margin-top: 15px">
@@ -305,9 +307,9 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
305307
<td>
306308
<a
307309
v-bind:href="percentLink(data.b.commit, data.a.commit, bench.name, run.casename)">
308-
<span v-bind:class="percentClass(run.percent)">{{ run.percent }}%{{run.isDodgy ?
309-
"?"
310-
: ""}}</span>
310+
<span v-bind:class="percentClass(run.percent)">
311+
{{ run.percent }}%{{run.isDodgy ? "?" : ""}}
312+
</span>
311313
</a>
312314
</td>
313315
</tr>
@@ -316,7 +318,7 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
316318
</tbody>
317319
</table>
318320
<br />
319-
<table class="compare" v-if="data && data.a.bootstrap">
321+
<table class="compare" v-if="data && data.a.bootstrap.length > 0">
320322
<tr>
321323
<td colspan="4">bootstrap timings; variance is 1-3% on smaller benchmarks! Values in seconds.</td>
322324
</tr>
@@ -354,6 +356,7 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
354356
data: {
355357
filter: {
356358
name: null,
359+
showOnlySignificant: true,
357360
cache: {
358361
full: true,
359362
incrFull: true,
@@ -423,19 +426,26 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
423426
let benches =
424427
Object.keys(data.a.data).
425428
filter(n => filter.name && filter.name.trim() ? n.includes(filter.name.trim()) : true).
426-
map(name => { return { name, variants: toVariants(name) } }).filter(b => b.variants.length > 0);
427-
428-
for (let bench of benches) {
429-
let pcts = bench.variants.map(field => parseFloat(field.percent))
430-
.filter(p => p != undefined && p != null);
431-
bench.maxPct = Math.max(...pcts).toFixed(1);
432-
bench.minPct = Math.min(...pcts).toFixed(1);
433-
let sum = pcts.reduce((a, b) => a + b, 0);
434-
bench.avgPct = (sum / pcts.length).toFixed(1);
435-
bench.maxCasenameLen = Math.max(...bench.variants.map(f => f.casename.length));
436-
}
437-
const largestChange = a => Math.max(Math.abs(a.minPct), Math.abs(a.maxPct));
429+
map(name => {
430+
const variants = toVariants(name).filter(v => filter.showOnlySignificant ? isSignificant(v) : true);
431+
const pcts = variants.map(field => parseFloat(field.percent));
432+
const maxPct = Math.max(...pcts).toFixed(1);
433+
const minPct = Math.min(...pcts).toFixed(1);
434+
const sum = pcts.reduce((a, b) => a + b, 0);
435+
const avgPct = (sum / pcts.length).toFixed(1);
436+
const maxCasenameLen = Math.max(...variants.map(f => f.casename.length));
437+
return {
438+
name,
439+
variants,
440+
maxPct,
441+
minPct,
442+
avgPct,
443+
maxCasenameLen,
444+
};
445+
}).
446+
filter(b => b.variants.length > 0);
438447

448+
const largestChange = a => Math.max(Math.abs(a.minPct), Math.abs(a.maxPct));
439449
benches.sort((a, b) => largestChange(b) - largestChange(a));
440450

441451
return benches;
@@ -526,6 +536,16 @@ <h1>Comparing <span id="stat-header">instructions:u</span> between <span id="bef
526536
}
527537
});
528538

539+
function isSignificant(variant) {
540+
const percent = Math.abs(variant.percent);
541+
if (variant.isDodgy) {
542+
return percent > 1.0;
543+
} else {
544+
return percent > 0.2;
545+
}
546+
547+
}
548+
529549
function toggleBenchGroup(element) {
530550
let next = element.parentElement.parentElement.nextElementSibling;
531551
let inBody = []

0 commit comments

Comments
 (0)