Skip to content

Commit e92928f

Browse files
authored
Merge pull request #1069 from rylev/no-grouping
Don't group testCases by benchmark/profile in comparison page
2 parents 50838e8 + fda19fe commit e92928f

File tree

1 file changed

+70
-103
lines changed

1 file changed

+70
-103
lines changed

site/static/compare.html

Lines changed: 70 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -423,10 +423,8 @@ <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>
426+
<th>Benchmark & Profile</th>
427427
<th>Scenario</th>
428-
<th>{{before}}</th>
429-
<th>{{after}}</th>
430428
<th>% Change</th>
431429
<th>
432430
Significance Factor<span class="tooltip">?
@@ -439,40 +437,39 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
439437
</span>
440438
</span>
441439
</th>
440+
<th>{{before}}</th>
441+
<th>{{after}}</th>
442442
</tr>
443443
</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>
444+
<tbody>
445+
<template v-for="testCase in testCases">
446+
<tr>
447+
<td>{{ testCase.benchmark }} {{ testCase.profile }}</td>
448+
<td>{{ testCase.scenario }}</td>
449+
<td>
450+
<a v-bind:href="percentLink(data.b.commit, data.a.commit, testCase)">
451+
<span v-bind:class="percentClass(testCase.percent)">
452+
{{ testCase.percent.toFixed(2) }}%{{testCase.isDodgy ? "?" : ""}}
453+
</span>
454+
</a>
455+
</td>
456+
<td>
457+
{{ testCase.significanceFactor ? testCase.significanceFactor.toFixed(2) + "x" :"-"
458+
}}
459+
</td>
460+
<td>
461+
<a v-bind:href="detailedQueryLink(data.a.commit, testCase)">
462+
{{ testCase.datumA }}
463+
</a>
464+
</td>
465+
<td>
466+
<a v-bind:href="detailedQueryLink(data.b.commit, testCase)">
467+
{{ testCase.datumB }}
468+
</a>
469+
</td>
470+
</tr>
471+
</template>
472+
</tbody>
476473
</table>
477474
<br />
478475
<table id="bootstrap" class="compare" style="margin: auto;"
@@ -552,7 +549,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
552549
compareLink() {
553550
return `https://github.com/rust-lang/rust/compare/${this.data.a.commit}...${this.data.b.commit}`;
554551
},
555-
benches() {
552+
testCases() {
556553
let data = this.data;
557554
const filter = this.filter;
558555

@@ -571,7 +568,8 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
571568
}
572569
}
573570

574-
function shouldShowTestCase(name, testCase) {
571+
function shouldShowTestCase(testCase) {
572+
const name = `${testCase.benchmark} ${testCase.profile} ${testCase.scenario}`;
575573
let nameFilter = filter.name && filter.name.trim();
576574
nameFilter = !nameFilter || name.includes(nameFilter);
577575

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

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-
}
583+
let testCases =
584+
data.comparisons
585+
.map(c => {
586+
const datumA = c.statistics[0];
587+
const datumB = c.statistics[1];
588+
const percent = 100 * ((datumB - datumA) / datumA);
589+
return {
590+
benchmark: c.benchmark,
591+
profile: c.profile,
592+
scenario: c.scenario,
593+
magnitude: c.magnitude,
594+
isSignificant: c.is_significant,
595+
significanceFactor: c.significance_factor,
596+
isDodgy: c.is_dodgy,
597+
datumA,
598+
datumB,
599+
percent,
600+
};
601+
})
602+
.filter(tc => shouldShowTestCase(tc))
606603

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));
639604
// Sort by name first, so that there is a canonical ordering
640-
// of benches. This ensures the overall order is stable, even if
605+
// of test cases. This ensures the overall order is stable, even if
641606
// 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));
607+
testCases.sort((a, b) => a.benchmark.localeCompare(b.benchmark));
608+
testCases.sort((a, b) => Math.abs(b.percent) - Math.abs(a.percent));
644609

645-
return benches;
610+
return testCases;
646611
},
647612
bootstrapTotals() {
648613
const sum = bootstrap => Object.entries(bootstrap).map(e => e[1] / 1e9).reduce((sum, next) => sum + next, 0);
@@ -699,7 +664,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
699664
},
700665
summary() {
701666
// 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])));
667+
const filtered = this.testCases.reduce((sum, next) => {
668+
sum[testCaseString(next)] = true;
669+
return sum;
670+
}, {});
703671
const newCount = { regressions: 0, improvements: 0, unchanged: 0 }
704672
let result = { all: { ...newCount }, filtered: { ...newCount } }
705673
for (let d of this.data.comparisons) {
@@ -734,15 +702,14 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
734702
let klass = "";
735703
if (pct > 1) {
736704
klass = 'positive';
737-
} else if (pct >= 0.2) {
705+
} else if (pct > 0) {
738706
klass = 'slightly-positive';
739707
} else if (pct < -1) {
740708
klass = 'negative';
741-
} else if (pct <= -0.2) {
709+
} else if (pct < -0) {
742710
klass = 'slightly-negative';
743711
}
744712
return klass;
745-
746713
},
747714
diffClass(diff) {
748715
let klass = "";
@@ -754,11 +721,11 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
754721
return klass;
755722

756723
},
757-
detailedQueryLink(commit, bench, testCase) {
758-
return `/detailed-query.html?commit=${commit}&benchmark=${bench}&run_name=${testCase}`;
724+
detailedQueryLink(commit, testCase) {
725+
return `/detailed-query.html?commit=${commit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
759726
},
760-
percentLink(commit, baseCommit, bench, testCase) {
761-
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${bench}&run_name=${testCase}`;
727+
percentLink(commit, baseCommit, testCase) {
728+
return `/detailed-query.html?commit=${commit}&base_commit=${baseCommit}&benchmark=${testCase.benchmark + "-" + testCase.profile}&run_name=${testCase.scenario}`;
762729
},
763730
commitLink(commit) {
764731
return `https://github.com/rust-lang/rust/commit/${commit}`;
@@ -847,4 +814,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
847814
</script>
848815
</body>
849816

850-
</html>
817+
</html>

0 commit comments

Comments
 (0)