Skip to content

Commit 44e652e

Browse files
committed
Don't group testCases by benchmark/profile
1 parent 50838e8 commit 44e652e

File tree

1 file changed

+67
-104
lines changed

1 file changed

+67
-104
lines changed

site/static/compare.html

Lines changed: 67 additions & 104 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
423423
<table id="benches" class="compare">
424424
<tbody>
425425
<tr>
426-
<th>Name & Profile</th>
427-
<th>Scenario</th>
428-
<th>{{before}}</th>
429-
<th>{{after}}</th>
426+
<th>Benchmark Profile Scenario</th>
430427
<th>% Change</th>
431428
<th>
432429
Significance Factor<span class="tooltip">?
@@ -439,40 +436,36 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
439436
</span>
440437
</span>
441438
</th>
439+
<th>{{before}} &lt;=&gt; {{after}}</th>
442440
</tr>
443441
</tbody>
444-
<template v-for="bench in benches">
445-
<tbody>
446-
<template v-for="testCase in bench.testCases">
447-
<tr>
448-
<th v-if="testCase.first" v-bind:rowspan="bench.testCases.length">{{bench.name}}</th>
449-
<td>{{ testCase.scenario }}</td>
450-
<td>
451-
<a v-bind:href="detailedQueryLink(data.a.commit, bench.name, testCase.scenario)">
452-
{{ testCase.datumA }}
453-
</a>
454-
</td>
455-
<td>
456-
<a v-bind:href="detailedQueryLink(data.b.commit, bench.name, testCase.scenario)">
457-
{{ testCase.datumB }}
458-
</a>
459-
</td>
460-
<td>
461-
<a
462-
v-bind:href="percentLink(data.b.commit, data.a.commit, bench.name, testCase.scenario)">
463-
<span v-bind:class="percentClass(testCase.percent)">
464-
{{ testCase.percent.toFixed(2) }}%{{testCase.isDodgy ? "?" : ""}}
465-
</span>
466-
</a>
467-
</td>
468-
<td>
469-
{{ testCase.significanceFactor ? testCase.significanceFactor.toFixed(2) + "x" :"-"
470-
}}
471-
</td>
472-
</tr>
473-
</template>
474-
</tbody>
475-
</template>
442+
<tbody>
443+
<template v-for="testCase in testCases">
444+
<tr>
445+
<td>{{ testCase.benchmark }} {{ testCase.profile }} <br /> {{ testCase.scenario }}</td>
446+
<td>
447+
<a v-bind:href="percentLink(data.b.commit, data.a.commit, testCase)">
448+
<span v-bind:class="percentClass(testCase.percent)">
449+
{{ testCase.percent.toFixed(2) }}%{{testCase.isDodgy ? "?" : ""}}
450+
</span>
451+
</a>
452+
</td>
453+
<td>
454+
{{ testCase.significanceFactor ? testCase.significanceFactor.toFixed(2) + "x" :"-"
455+
}}
456+
</td>
457+
<td>
458+
<a v-bind:href="detailedQueryLink(data.a.commit, testCase)">
459+
{{ testCase.datumA }}
460+
</a>
461+
&lt;=&gt;
462+
<a v-bind:href="detailedQueryLink(data.b.commit, testCase)">
463+
{{ testCase.datumB }}
464+
</a>
465+
</td>
466+
</tr>
467+
</template>
468+
</tbody>
476469
</table>
477470
<br />
478471
<table id="bootstrap" class="compare" style="margin: auto;"
@@ -552,7 +545,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
552545
compareLink() {
553546
return `https://github.com/rust-lang/rust/compare/${this.data.a.commit}...${this.data.b.commit}`;
554547
},
555-
benches() {
548+
testCases() {
556549
let data = this.data;
557550
const filter = this.filter;
558551

@@ -571,7 +564,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
571564
}
572565
}
573566

574-
function shouldShowTestCase(name, testCase) {
567+
function shouldShowTestCase(testCase) {
568+
const name = `${testCase.benchmark} ${testCase.profile} ${testCase.scenario}`;
575569
let nameFilter = filter.name && filter.name.trim();
576570
nameFilter = !nameFilter || name.includes(nameFilter);
577571

@@ -582,67 +576,34 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
582576
return scenarioFilter(testCase.scenario) && significanceFilter && nameFilter && magnitudeFilter;
583577
}
584578

585-
function toTestCases(name, results) {
586-
return results.map(r => {
587-
const scenario = r.scenario;
588-
const datumA = r.statistics[0];
589-
const datumB = r.statistics[1];
590-
const isSignificant = r.is_significant;
591-
const significanceFactor = r.significance_factor;
592-
const isDodgy = r.is_dodgy;
593-
let percent = 100 * ((datumB - datumA) / datumA);
594-
return {
595-
scenario,
596-
datumA,
597-
datumB,
598-
isSignificant,
599-
magnitude: r.magnitude,
600-
significanceFactor,
601-
isDodgy,
602-
percent,
603-
};
604-
}).filter(tc => shouldShowTestCase(name, tc))
605-
}
579+
let testCases =
580+
data.comparisons
581+
.map(c => {
582+
const datumA = c.statistics[0];
583+
const datumB = c.statistics[1];
584+
const percent = 100 * ((datumB - datumA) / datumA);
585+
return {
586+
benchmark: c.benchmark,
587+
profile: c.profile,
588+
scenario: c.scenario,
589+
magnitude: c.magnitude,
590+
isSignificant: c.is_significant,
591+
significanceFactor: c.significance_factor,
592+
isDodgy: c.is_dodgy,
593+
datumA,
594+
datumB,
595+
percent,
596+
};
597+
})
598+
.filter(tc => shouldShowTestCase(tc))
606599

607-
let benches =
608-
data.comparisons.
609-
reduce((accum, next) => {
610-
const key = next.benchmark + "-" + next.profile;
611-
if (!accum[key]) {
612-
accum[key] = [];
613-
}
614-
accum[key].push(next);
615-
return accum;
616-
}, {});
617-
benches = Object.entries(benches).
618-
map(c => {
619-
const name = c[0];
620-
const comparison = c[1];
621-
const testCases = toTestCases(name, comparison);
622-
const pcts = testCases.map(tc => parseFloat(tc.percent));
623-
const maxPct = Math.max(...pcts).toFixed(1);
624-
const minPct = Math.min(...pcts).toFixed(1);
625-
if (testCases.length > 0) {
626-
testCases[0].first = true;
627-
}
628-
629-
return {
630-
name,
631-
testCases,
632-
maxPct,
633-
minPct,
634-
};
635-
}).
636-
filter(b => b.testCases.length > 0);
637-
638-
const largestChange = a => Math.max(Math.abs(a.minPct), Math.abs(a.maxPct));
639600
// Sort by name first, so that there is a canonical ordering
640-
// of benches. This ensures the overall order is stable, even if
601+
// of test cases. This ensures the overall order is stable, even if
641602
// individual benchmarks have the same largestChange value.
642-
benches.sort((a, b) => a.name.localeCompare(b.name));
643-
benches.sort((a, b) => largestChange(b) - largestChange(a));
603+
testCases.sort((a, b) => a.benchmark.localeCompare(b.benchmark));
604+
testCases.sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
644605

645-
return benches;
606+
return testCases;
646607
},
647608
bootstrapTotals() {
648609
const sum = bootstrap => Object.entries(bootstrap).map(e => e[1] / 1e9).reduce((sum, next) => sum + next, 0);
@@ -699,7 +660,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
699660
},
700661
summary() {
701662
// Create object with each test case that is not filtered out as a key
702-
const filtered = Object.fromEntries(this.benches.flatMap(b => b.testCases.map(v => [b.name + "-" + v.scenario, true])));
663+
const filtered = this.testCases.reduce((sum, next) => {
664+
sum[testCaseString(next)] = true;
665+
return sum;
666+
}, {});
703667
const newCount = { regressions: 0, improvements: 0, unchanged: 0 }
704668
let result = { all: { ...newCount }, filtered: { ...newCount } }
705669
for (let d of this.data.comparisons) {
@@ -734,15 +698,14 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
734698
let klass = "";
735699
if (pct > 1) {
736700
klass = 'positive';
737-
} else if (pct >= 0.2) {
701+
} else if (pct > 0) {
738702
klass = 'slightly-positive';
739703
} else if (pct < -1) {
740704
klass = 'negative';
741-
} else if (pct <= -0.2) {
705+
} else if (pct < -0) {
742706
klass = 'slightly-negative';
743707
}
744708
return klass;
745-
746709
},
747710
diffClass(diff) {
748711
let klass = "";
@@ -754,11 +717,11 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
754717
return klass;
755718

756719
},
757-
detailedQueryLink(commit, bench, testCase) {
758-
return `/detailed-query.html?commit=${commit}&benchmark=${bench}&run_name=${testCase}`;
720+
detailedQueryLink(commit, testCase) {
721+
return `/detailed-query.html?commit=${commit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
759722
},
760-
percentLink(commit, baseCommit, bench, testCase) {
761-
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${bench}&run_name=${testCase}`;
723+
percentLink(commit, baseCommit, testCase) {
724+
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
762725
},
763726
commitLink(commit) {
764727
return `https://github.com/rust-lang/rust/commit/${commit}`;
@@ -847,4 +810,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
847810
</script>
848811
</body>
849812

850-
</html>
813+
</html>

0 commit comments

Comments
 (0)