@@ -571,9 +571,9 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
571
571
}
572
572
}
573
573
574
- function shouldShowTestCase ( testCase ) {
574
+ function shouldShowTestCase ( name , testCase ) {
575
575
let nameFilter = filter . name && filter . name . trim ( ) ;
576
- nameFilter = ! nameFilter || ( testCase . benchmark + "-" + testCase . profile ) . includes ( nameFilter ) ;
576
+ nameFilter = ! nameFilter || name . includes ( nameFilter ) ;
577
577
578
578
const significanceFilter = filter . showOnlySignificant ? testCase . isSignificant : true ;
579
579
@@ -582,17 +582,16 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
582
582
return scenarioFilter ( testCase . scenario ) && significanceFilter && nameFilter && magnitudeFilter ;
583
583
}
584
584
585
- function toTestCases ( results ) {
586
- let testCases = [ ] ;
587
- for ( let r of results ) {
585
+ function toTestCases ( name , results ) {
586
+ return results . map ( r => {
588
587
const scenario = r . scenario ;
589
588
const datumA = r . statistics [ 0 ] ;
590
589
const datumB = r . statistics [ 1 ] ;
591
590
const isSignificant = r . is_significant ;
592
591
const significanceFactor = r . significance_factor ;
593
592
const isDodgy = r . is_dodgy ;
594
593
let percent = 100 * ( ( datumB - datumA ) / datumA ) ;
595
- let testCase = {
594
+ return {
596
595
scenario,
597
596
datumA,
598
597
datumB,
@@ -602,12 +601,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
602
601
isDodgy,
603
602
percent,
604
603
} ;
605
- if ( shouldShowTestCase ( testCase ) ) {
606
- testCases . push ( testCase ) ;
607
- }
608
- }
609
-
610
- return testCases ;
604
+ } ) . filter ( tc => shouldShowTestCase ( name , tc ) )
611
605
}
612
606
613
607
let benches =
@@ -624,7 +618,7 @@ <h2>Comparing <span id="stat-header">{{stat}}</span> between <span id="before">{
624
618
map ( c => {
625
619
const name = c [ 0 ] ;
626
620
const comparison = c [ 1 ] ;
627
- const testCases = toTestCases ( comparison ) ;
621
+ const testCases = toTestCases ( name , comparison ) ;
628
622
const pcts = testCases . map ( tc => parseFloat ( tc . percent ) ) ;
629
623
const maxPct = Math . max ( ...pcts ) . toFixed ( 1 ) ;
630
624
const minPct = Math . min ( ...pcts ) . toFixed ( 1 ) ;
0 commit comments