Skip to content

Commit fb335b3

Browse files
Merge pull request #1004 from Mark-Simulacrum/fix-sort
Avoid reordering on refresh
2 parents 8d3a2e9 + 563ce79 commit fb335b3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

site/static/compare.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,10 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
616616
filter(b => b.variants.length > 0);
617617

618618
const largestChange = a => Math.max(Math.abs(a.minPct), Math.abs(a.maxPct));
619+
// Sort by name first, so that there is a canonical ordering
620+
// of benches. This ensures the overall order is stable, even if
621+
// individual benchmarks have the same largestChange value.
622+
benches.sort((a, b) => a.name.localeCompare(b.name));
619623
benches.sort((a, b) => largestChange(b) - largestChange(a));
620624

621625
return benches;
@@ -819,4 +823,4 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
819823
</script>
820824
</body>
821825

822-
</html>
826+
</html>

0 commit comments

Comments
 (0)