@@ -115,7 +115,7 @@ if (isInBrowser) {
115
115
116
116
function assert ( b , m = "" ) {
117
117
if ( ! b )
118
- throw new Error ( " Bad assertion: " + m ) ;
118
+ throw new Error ( ` Bad assertion: ${ m } ` ) ;
119
119
}
120
120
121
121
function firstID ( benchmark ) {
@@ -177,17 +177,8 @@ function uiFriendlyScore(num) {
177
177
return uiFriendlyNumber ( num ) ;
178
178
}
179
179
180
- function uiFriendlyDuration ( time )
181
- {
182
- const minutes = time . getMinutes ( ) ;
183
- const seconds = time . getSeconds ( ) ;
184
- const milliSeconds = time . getMilliseconds ( ) ;
185
- let result = "" + minutes + ":" ;
186
-
187
- result = result + ( seconds < 10 ? "0" : "" ) + seconds + "." ;
188
- result = result + ( milliSeconds < 10 ? "00" : ( milliSeconds < 100 ? "0" : "" ) ) + milliSeconds ;
189
-
190
- return result ;
180
+ function uiFriendlyDuration ( time ) {
181
+ return `${ time . toFixed ( 3 ) } ms` ;
191
182
}
192
183
193
184
const fileLoader = ( function ( ) {
@@ -321,7 +312,7 @@ class Driver {
321
312
322
313
if ( isInBrowser ) {
323
314
summaryElement . classList . add ( 'done' ) ;
324
- summaryElement . innerHTML = " <div class=\ "score\">" + uiFriendlyScore ( geomean ( allScores ) ) + " </div><label>Score</label>" ;
315
+ summaryElement . innerHTML = ` <div class="score"> ${ uiFriendlyScore ( geomean ( allScores ) ) } </div><label>Score</label>` ;
325
316
summaryElement . onclick = displayCategoryScores ;
326
317
if ( showScoreDetails )
327
318
displayCategoryScores ( ) ;
@@ -391,7 +382,7 @@ class Driver {
391
382
392
383
const magicFrame = magic . contentDocument . getElementById ( "magicframe" ) ;
393
384
magicFrame . contentDocument . open ( ) ;
394
- magicFrame . contentDocument . write ( " <!DOCTYPE html><head><title>benchmark payload</title></head><body>\n" + string + " </body></html>" ) ;
385
+ magicFrame . contentDocument . write ( ` <!DOCTYPE html><head><title>benchmark payload</title></head><body>\n${ string } </body></html>` ) ;
395
386
396
387
return magicFrame ;
397
388
}
@@ -1127,7 +1118,7 @@ class DefaultBenchmark extends Benchmark {
1127
1118
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1128
1119
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
1129
1120
}
1130
- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1121
+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
1131
1122
}
1132
1123
}
1133
1124
@@ -1347,7 +1338,7 @@ class WSLBenchmark extends Benchmark {
1347
1338
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1348
1339
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
1349
1340
}
1350
- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1341
+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
1351
1342
}
1352
1343
} ;
1353
1344
@@ -1533,7 +1524,7 @@ class WasmLegacyBenchmark extends Benchmark {
1533
1524
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1534
1525
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
1535
1526
}
1536
- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1527
+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
1537
1528
}
1538
1529
} ;
1539
1530
0 commit comments