@@ -115,7 +115,7 @@ if (isInBrowser) {
115115
116116function assert ( b , m = "" ) {
117117 if ( ! b )
118- throw new Error ( " Bad assertion: " + m ) ;
118+ throw new Error ( ` Bad assertion: ${ m } ` ) ;
119119}
120120
121121function firstID ( benchmark ) {
@@ -177,17 +177,8 @@ function uiFriendlyScore(num) {
177177 return uiFriendlyNumber ( num ) ;
178178}
179179
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` ;
191182}
192183
193184const fileLoader = ( function ( ) {
@@ -321,7 +312,7 @@ class Driver {
321312
322313 if ( isInBrowser ) {
323314 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>` ;
325316 summaryElement . onclick = displayCategoryScores ;
326317 if ( showScoreDetails )
327318 displayCategoryScores ( ) ;
@@ -391,7 +382,7 @@ class Driver {
391382
392383 const magicFrame = magic . contentDocument . getElementById ( "magicframe" ) ;
393384 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>` ) ;
395386
396387 return magicFrame ;
397388 }
@@ -1127,7 +1118,7 @@ class DefaultBenchmark extends Benchmark {
11271118 console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
11281119 console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
11291120 }
1130- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1121+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
11311122 }
11321123}
11331124
@@ -1347,7 +1338,7 @@ class WSLBenchmark extends Benchmark {
13471338 console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
13481339 console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
13491340 }
1350- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1341+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
13511342 }
13521343} ;
13531344
@@ -1533,7 +1524,7 @@ class WasmLegacyBenchmark extends Benchmark {
15331524 console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
15341525 console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
15351526 }
1536- console . log ( " Wall time:" , uiFriendlyDuration ( new Date ( this . endTime - this . startTime ) ) ) ;
1527+ console . log ( " Wall time:" , uiFriendlyDuration ( this . endTime - this . startTime ) ) ;
15371528 }
15381529} ;
15391530
0 commit comments