@@ -21,6 +21,7 @@ interface State {
2121 separateKeyedAndNonKeyed : boolean ;
2222 resultTables : Array < ResultTableData > ;
2323 sortKey : string ;
24+ compareWith : Framework | undefined ;
2425}
2526
2627let allBenchmarks = ( ) => benchmarks . reduce ( ( set , b ) => set . add ( b ) , new Set ( ) ) ;
@@ -37,13 +38,13 @@ class App extends React.Component<{}, State> {
3738 event . preventDefault ( ) ;
3839 let set = this . state . selectedBenchmarks ;
3940 benchmarks . forEach ( b => { if ( ( b . type === BenchmarkType . MEM ) === memBenchmarks ) set . add ( b ) ; } ) ;
40- this . setState ( { selectedBenchmarks : set , resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , this . state . sortKey ) } ) ;
41+ this . setState ( { selectedBenchmarks : set , resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , this . state . sortKey , this . state . compareWith ) } ) ;
4142 } ,
4243 selectNone : ( event : React . SyntheticEvent < any > ) => {
4344 event . preventDefault ( ) ;
4445 let set = this . state . selectedBenchmarks ;
4546 benchmarks . forEach ( b => { if ( ( b . type === BenchmarkType . MEM ) === memBenchmarks ) set . delete ( b ) ; } ) ;
46- this . setState ( { selectedBenchmarks : set , sortKey : SORT_BY_NAME , resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , SORT_BY_NAME ) } ) ;
47+ this . setState ( { selectedBenchmarks : set , sortKey : SORT_BY_NAME , resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , SORT_BY_NAME , this . state . compareWith ) } ) ;
4748 } ,
4849 areAllSelected : ( ) => benchmarks . filter ( b => memBenchmarks ? b . type === BenchmarkType . MEM : b . type !== BenchmarkType . MEM )
4950 . every ( b => this . state . selectedBenchmarks . has ( b ) ) ,
@@ -56,13 +57,13 @@ class App extends React.Component<{}, State> {
5657 event . preventDefault ( ) ;
5758 let set = this . state . selectedFrameworks ;
5859 frameworks . forEach ( framework => { if ( framework . nonKeyed === nonKeyed && ! set . has ( framework ) ) set . add ( framework ) ; } ) ;
59- this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey ) } ) ;
60+ this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey , this . state . compareWith ) } ) ;
6061 } ,
6162 selectNone : ( event : React . SyntheticEvent < any > ) => {
6263 event . preventDefault ( ) ;
6364 let set = this . state . selectedFrameworks ;
6465 set . forEach ( framework => { if ( framework . nonKeyed === nonKeyed ) set . delete ( framework ) ; } ) ;
65- this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey ) } ) ;
66+ this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey , this . state . compareWith ) } ) ;
6667 } ,
6768 areAllSelected : ( ) => frameworks . filter ( f => f . nonKeyed === nonKeyed ) . every ( f => this . state . selectedFrameworks . has ( f ) ) ,
6869 isNoneSelected : ( ) => frameworks . filter ( f => f . nonKeyed === nonKeyed ) . every ( f => ! this . state . selectedFrameworks . has ( f ) ) ,
@@ -84,8 +85,9 @@ class App extends React.Component<{}, State> {
8485 selectedBenchmarks : _allBenchmarks ,
8586 selectedFrameworks : _allFrameworks ,
8687 separateKeyedAndNonKeyed : true ,
87- resultTables : this . updateResultTable ( _allBenchmarks , _allFrameworks , true , SORT_BY_NAME ) ,
88- sortKey : SORT_BY_NAME
88+ resultTables : this . updateResultTable ( _allBenchmarks , _allFrameworks , true , SORT_BY_NAME , undefined ) ,
89+ sortKey : SORT_BY_NAME ,
90+ compareWith : undefined
8991 } ;
9092 }
9193 selectBenchmark = ( benchmark : Benchmark , value : boolean ) => {
@@ -97,29 +99,39 @@ class App extends React.Component<{}, State> {
9799 let setIds = new Set ( ) ;
98100 set . forEach ( b => setIds . add ( b . id ) )
99101 if ( ( sortKey != SORT_BY_NAME && sortKey != SORT_BY_GEOMMEAN ) && ! setIds . has ( sortKey ) ) sortKey = SORT_BY_NAME ;
100- this . setState ( { selectedBenchmarks : set , sortKey, resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , sortKey ) } ) ;
102+ this . setState ( { selectedBenchmarks : set , sortKey, resultTables : this . updateResultTable ( set , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , sortKey , this . state . compareWith ) } ) ;
101103 }
102104 selectFramework = ( framework : Framework , value : boolean ) : void => {
103105 let set = new Set ( ) ;
104106 this . state . selectedFrameworks . forEach ( framework => set . add ( framework ) ) ;
105107 if ( set . has ( framework ) ) set . delete ( framework ) ;
106108 else set . add ( framework ) ;
107- this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey ) } ) ;
109+ this . setState ( { selectedFrameworks : set , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , set , this . state . separateKeyedAndNonKeyed , this . state . sortKey , this . state . compareWith ) } ) ;
108110 }
109111 selectSeparateKeyedAndNonKeyed = ( value : boolean ) : void => {
110- this . setState ( { separateKeyedAndNonKeyed : value , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , this . state . selectedFrameworks , value , this . state . sortKey ) } ) ;
112+ this . setState ( { separateKeyedAndNonKeyed : value , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , this . state . selectedFrameworks , value , this . state . sortKey , this . state . compareWith ) } ) ;
111113 }
112- updateResultTable ( selectedBenchmarks : Set < Benchmark > , selectedFrameworks : Set < Framework > , separateKeyedAndNonKeyed : boolean , sortKey : string ) {
114+ updateResultTable ( selectedBenchmarks : Set < Benchmark > , selectedFrameworks : Set < Framework > , separateKeyedAndNonKeyed : boolean , sortKey : string , compareWith : Framework | undefined ) {
113115 if ( separateKeyedAndNonKeyed ) {
114- return [ new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , false , sortKey ) ,
115- new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , true , sortKey ) ]
116+ return [ new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , false , sortKey , compareWith ) ,
117+ new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , true , sortKey , compareWith ) ]
116118 } else {
117- return [ new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , undefined , sortKey ) ]
119+ return [ new ResultTableData ( frameworks , benchmarks , resultLookup , selectedFrameworks , selectedBenchmarks , undefined , sortKey , compareWith ) ]
118120 }
119121 }
122+ selectComparison = ( framework : string ) : void => {
123+ let compareWith : Framework | undefined = undefined ;
124+ compareWith = this . state . frameworksKeyed . find ( ( f ) => f . name === framework ) ;
125+ if ( ! compareWith ) {
126+ compareWith = this . state . frameworksNonKeyed . find ( ( f ) => f . name === framework ) ;
127+ }
128+ console . log ( "compareWith" , compareWith ) ;
129+ this . setState ( { compareWith :compareWith , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , this . state . sortKey , compareWith ) } ) ;
130+ }
131+
120132 sortBy = ( sortkey : string , tableIdx : number ) : void => {
121133 this . state . resultTables [ tableIdx ] . sortBy ( sortkey ) ;
122- this . setState ( { sortKey :sortkey , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , sortkey ) } ) ;
134+ this . setState ( { sortKey :sortkey , resultTables : this . updateResultTable ( this . state . selectedBenchmarks , this . state . selectedFrameworks , this . state . separateKeyedAndNonKeyed , sortkey , this . state . compareWith ) } ) ;
123135 }
124136 render ( ) {
125137 let disclaimer = ( false ) ? ( < div >
@@ -143,7 +155,15 @@ class App extends React.Component<{}, State> {
143155 selectBenchmark = { this . selectBenchmark }
144156 selectFramework = { this . selectFramework }
145157 selectSeparateKeyedAndNonKeyed = { this . selectSeparateKeyedAndNonKeyed }
146- separateKeyedAndNonKeyed = { this . state . separateKeyedAndNonKeyed } />
158+ separateKeyedAndNonKeyed = { this . state . separateKeyedAndNonKeyed }
159+ compareWith = { this . state . compareWith }
160+ selectComparison = { this . selectComparison }
161+ />
162+ { ! this . state . compareWith ? null :
163+ ( < p style = { { marginTop :'10px' } } > In comparison mode white cells mean there's no statistically significant difference.
164+ Green cells are significantly faster than the comparison and red cells are slower.
165+ The test is performed as a one sided t-test. The significance level is 10%. The darker the color the lower the p-Value.</ p >
166+ ) }
147167 < ResultTable currentSortKey = { this . state . sortKey } data = { this . state . resultTables } separateKeyedAndNonKeyed = { this . state . separateKeyedAndNonKeyed } sortBy = { this . sortBy } />
148168 </ div >
149169 ) ;
0 commit comments