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) {
6767	for  ( const  metric  of  [ 'time' ,  'gc_time' ] )  { 
6868		const  times  =  results . map ( ( result )  =>  + result [ i ] [ metric ] ) ; 
6969		let  min  =  Infinity ; 
70+ 		let  max  =  - Infinity ; 
7071		let  min_index  =  - 1 ; 
7172
7273		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 ; 
7578				min_index  =  b ; 
7679			} 
80+ 
81+ 			if  ( time  >  max )  { 
82+ 				max  =  time ; 
83+ 			} 
7784		} 
7885
7986		if  ( min  !==  0 )  { 
80- 			console . group ( `${ metric }  : fastest is ${ branches [ min_index ] }  ` ) ; 
87+ 			console . group ( `${ metric }  : fastest is ${ char ( min_index ) }  ( ${ branches [ min_index ] } ) ` ) ; 
8188			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` ) ; 
8393			} ) ; 
8494			console . groupEnd ( ) ; 
8595		} 
8696	} 
8797
8898	console . groupEnd ( ) ; 
8999} 
100+ 
101+ function  char ( i )  { 
102+ 	return  String . fromCharCode ( 97  +  i ) ; 
103+ } 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments