1
1
/// run `make perf-tester` after updating this or util.js
2
2
3
3
import fs from 'fs' ;
4
- import ms from 'ms' ;
5
4
import { exec } from '@actions/exec' ;
6
5
7
6
export const getInput = key => ( {
@@ -32,7 +31,7 @@ function parse(benchmarkData) {
32
31
for ( let i = 0 ; i < lines . length - 1 ; i += 2 ) {
33
32
const [ , name ] = firstLineRe . exec ( lines [ i ] )
34
33
const [ , time ] = secondLineRe . exec ( lines [ i + 1 ] )
35
- benchmarks [ name ] = parseFloat ( time )
34
+ benchmarks [ name ] = Math . round ( parseFloat ( time ) )
36
35
}
37
36
return benchmarks
38
37
}
@@ -96,7 +95,7 @@ export function stripHash(regex) {
96
95
* @param {number } difference
97
96
*/
98
97
export function getDeltaText ( delta , difference ) {
99
- let deltaText = ( delta > 0 ? '+' : '' ) + ms ( delta ) ;
98
+ let deltaText = ( delta > 0 ? '+' : '' ) + delta + 'ms' ;
100
99
if ( delta && Math . abs ( delta ) > 1 ) {
101
100
deltaText += ` (${ Math . abs ( difference ) } %)` ;
102
101
}
@@ -185,7 +184,7 @@ export function diffTable(tests, { showTotal, collapseUnchanged, omitUnchanged,
185
184
186
185
const columns = [
187
186
name ,
188
- ms ( time ) ,
187
+ time + 'ms' ,
189
188
getDeltaText ( delta , difference ) ,
190
189
iconForDifference ( difference )
191
190
] ;
@@ -207,7 +206,7 @@ export function diffTable(tests, { showTotal, collapseUnchanged, omitUnchanged,
207
206
const totalDifference = ( ( totalDelta / totalTime ) * 100 ) | 0 ;
208
207
let totalDeltaText = getDeltaText ( totalDelta , totalDifference ) ;
209
208
let totalIcon = iconForDifference ( totalDifference ) ;
210
- out = `**Total Size:** ${ ms ( totalTime ) } \n\n${ out } ` ;
209
+ out = `**Total Size:** ${ totalTime . toLocaleString ( 'en-US' ) } ms \n\n${ out } ` ;
211
210
out = `**Size Change:** ${ totalDeltaText } ${ totalIcon } \n\n${ out } ` ;
212
211
}
213
212
0 commit comments