File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -67,23 +67,37 @@ for (let i = 0; i < results[0].length; i += 1) {
67
67
for ( const metric of [ 'time' , 'gc_time' ] ) {
68
68
const times = results . map ( ( result ) => + result [ i ] [ metric ] ) ;
69
69
let min = Infinity ;
70
+ let max = - Infinity ;
70
71
let min_index = - 1 ;
71
72
72
73
for ( let b = 0 ; b < times . length ; b += 1 ) {
73
- if ( times [ b ] < min ) {
74
- min = times [ b ] ;
74
+ const time = times [ b ] ;
75
+
76
+ if ( time < min ) {
77
+ min = time ;
75
78
min_index = b ;
76
79
}
80
+
81
+ if ( time > max ) {
82
+ max = time ;
83
+ }
77
84
}
78
85
79
86
if ( min !== 0 ) {
80
- console . group ( `${ metric } : fastest is ${ branches [ min_index ] } ` ) ;
87
+ console . group ( `${ metric } : fastest is ${ char ( min_index ) } ( ${ branches [ min_index ] } ) ` ) ;
81
88
times . forEach ( ( time , b ) => {
82
- console . log ( `${ branches [ b ] } : ${ time . toFixed ( 2 ) } ms (${ ( ( time / min ) * 100 ) . toFixed ( 2 ) } %)` ) ;
89
+ const SIZE = 20 ;
90
+ const n = Math . round ( SIZE * ( time / max ) ) ;
91
+
92
+ console . log ( `${ char ( b ) } : ${ '◼' . repeat ( n ) } ${ ' ' . repeat ( SIZE - n ) } ${ time . toFixed ( 2 ) } ms` ) ;
83
93
} ) ;
84
94
console . groupEnd ( ) ;
85
95
}
86
96
}
87
97
88
98
console . groupEnd ( ) ;
89
99
}
100
+
101
+ function char ( i ) {
102
+ return String . fromCharCode ( 97 + i ) ;
103
+ }
You can’t perform that action at this time.
0 commit comments