File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -41,14 +41,20 @@ function benchmark(): void {
4141}
4242benchmark ( ) ;
4343
44+ function sortByName ( { benchmarkName : a } : BenchmarkResult , { benchmarkName : b } : BenchmarkResult ) : number {
45+ if ( a < b ) return - 1 ;
46+ if ( a > b ) return 1 ;
47+ return 0 ;
48+ }
49+
4450function compareBenchmarks ( oldResults : BenchmarkResult [ ] , newResults : BenchmarkResult [ ] ) : ComparisonInfo {
45- const oldResultsMemory = oldResults . filter ( isMemoryBenchmarkResult ) ;
46- const newResultsMemory = newResults . filter ( isMemoryBenchmarkResult ) ;
51+ const oldResultsMemory = oldResults . filter ( isMemoryBenchmarkResult ) . sort ( sortByName ) ;
52+ const newResultsMemory = newResults . filter ( isMemoryBenchmarkResult ) . sort ( sortByName ) ;
4753
4854 const memoryComparisonInfo = compareMemoryBenchmarks ( oldResultsMemory , newResultsMemory ) ;
4955
50- const oldResultsRuntime = oldResults . filter ( isRuntimeBenchmarkResult ) ;
51- const newResultsRuntime = newResults . filter ( isRuntimeBenchmarkResult ) ;
56+ const oldResultsRuntime = oldResults . filter ( isRuntimeBenchmarkResult ) . sort ( sortByName ) ;
57+ const newResultsRuntime = newResults . filter ( isRuntimeBenchmarkResult ) . sort ( sortByName ) ;
5258
5359 const runtimeComparisonInfo = compareRuntimeBenchmarks ( oldResultsRuntime , newResultsRuntime ) ;
5460
You can’t perform that action at this time.
0 commit comments