@@ -65,7 +65,7 @@ function displayCategoryScores() {
65
65
66
66
let summaryElement = document . getElementById ( "result-summary" ) ;
67
67
for ( let [ category , scores ] of categoryScores )
68
- summaryElement . innerHTML += `<p> ${ category } : ${ uiFriendlyNumber ( geomean ( scores ) ) } </p>`
68
+ summaryElement . innerHTML += `<p> ${ category } : ${ uiFriendlyScore ( geomean ( scores ) ) } </p>`
69
69
70
70
categoryScores = null ;
71
71
}
@@ -159,6 +159,10 @@ function uiFriendlyNumber(num) {
159
159
return num . toFixed ( 3 ) ;
160
160
}
161
161
162
+ function uiFriendlyScore ( num ) {
163
+ return uiFriendlyNumber ( num ) ;
164
+ }
165
+
162
166
function uiFriendlyDuration ( time )
163
167
{
164
168
const minutes = time . getMinutes ( ) ;
@@ -286,30 +290,30 @@ class Driver {
286
290
287
291
categoryScores = new Map ;
288
292
for ( const benchmark of this . benchmarks ) {
289
- for ( let category of Object . keys ( benchmark . subTimes ( ) ) )
293
+ for ( let category of Object . keys ( benchmark . subScores ( ) ) )
290
294
categoryScores . set ( category , [ ] ) ;
291
295
}
292
296
293
297
for ( const benchmark of this . benchmarks ) {
294
- for ( let [ category , value ] of Object . entries ( benchmark . subTimes ( ) ) ) {
298
+ for ( let [ category , value ] of Object . entries ( benchmark . subScores ( ) ) ) {
295
299
const arr = categoryScores . get ( category ) ;
296
300
arr . push ( value ) ;
297
301
}
298
302
}
299
303
300
304
if ( isInBrowser ) {
301
305
summaryElement . classList . add ( 'done' ) ;
302
- summaryElement . innerHTML = "<div class=\"score\">" + uiFriendlyNumber ( geomean ( allScores ) ) + "</div><label>Score</label>" ;
306
+ summaryElement . innerHTML = "<div class=\"score\">" + uiFriendlyScore ( geomean ( allScores ) ) + "</div><label>Score</label>" ;
303
307
summaryElement . onclick = displayCategoryScores ;
304
308
if ( showScoreDetails )
305
309
displayCategoryScores ( ) ;
306
310
statusElement . innerHTML = '' ;
307
311
} else if ( ! dumpJSONResults ) {
308
312
console . log ( "\n" ) ;
309
313
for ( let [ category , scores ] of categoryScores )
310
- console . log ( `${ category } : ${ uiFriendlyNumber ( geomean ( scores ) ) } ` ) ;
314
+ console . log ( `${ category } : ${ uiFriendlyScore ( geomean ( scores ) ) } ` ) ;
311
315
312
- console . log ( "\nTotal Score: " , uiFriendlyNumber ( geomean ( allScores ) ) , "\n" ) ;
316
+ console . log ( "\nTotal Score: " , uiFriendlyScore ( geomean ( allScores ) ) , "\n" ) ;
313
317
}
314
318
315
319
this . reportScoreToRunBenchmarkRunner ( ) ;
@@ -484,9 +488,9 @@ class Driver {
484
488
const results = { } ;
485
489
for ( const benchmark of this . benchmarks ) {
486
490
const subResults = { }
487
- const subTimes = benchmark . subTimes ( ) ;
488
- for ( const name in subTimes ) {
489
- subResults [ name ] = { "metrics" : { "Time" : { "current" : [ toTimeValue ( subTimes [ name ] ) ] } } } ;
491
+ const subScores = benchmark . subScores ( ) ;
492
+ for ( const name in subScores ) {
493
+ subResults [ name ] = { "metrics" : { "Time" : { "current" : [ toTimeValue ( subScores [ name ] ) ] } } } ;
490
494
}
491
495
results [ benchmark . name ] = {
492
496
"metrics" : {
@@ -915,9 +919,12 @@ class DefaultBenchmark extends Benchmark {
915
919
super ( ...args ) ;
916
920
917
921
this . worstCaseCount = getWorstCaseCount ( this . plan ) ;
918
- this . firstIteration = null ;
919
- this . worst4 = null ;
920
- this . average = null ;
922
+ this . firstIterationTime = null ;
923
+ this . firstIterationScore = null ;
924
+ this . worst4Time = null ;
925
+ this . worst4Score = null ;
926
+ this . averageTime = null ;
927
+ this . averageScore = null ;
921
928
922
929
assert ( this . iterations > this . worstCaseCount ) ;
923
930
}
@@ -931,7 +938,8 @@ class DefaultBenchmark extends Benchmark {
931
938
}
932
939
results = copyArray ( results ) ;
933
940
934
- this . firstIteration = toScore ( results [ 0 ] ) ;
941
+ this . firstIterationTime = results [ 0 ] ;
942
+ this . firstIterationScore = toScore ( results [ 0 ] ) ;
935
943
936
944
results = results . slice ( 1 ) ;
937
945
results . sort ( ( a , b ) => a < b ? 1 : - 1 ) ;
@@ -941,19 +949,21 @@ class DefaultBenchmark extends Benchmark {
941
949
const worstCase = [ ] ;
942
950
for ( let i = 0 ; i < this . worstCaseCount ; ++ i )
943
951
worstCase . push ( results [ i ] ) ;
944
- this . worst4 = toScore ( mean ( worstCase ) ) ;
945
- this . average = toScore ( mean ( results ) ) ;
952
+ this . worst4Time = mean ( worstCase ) ;
953
+ this . worst4Score = toScore ( this . worst4Time ) ;
954
+ this . averageTime = mean ( results ) ;
955
+ this . averageScore = toScore ( this . averageTime ) ;
946
956
}
947
957
948
958
get score ( ) {
949
- return geomean ( [ this . firstIteration , this . worst4 , this . average ] ) ;
959
+ return geomean ( [ this . firstIterationScore , this . worst4Score , this . averageScore ] ) ;
950
960
}
951
961
952
- subTimes ( ) {
962
+ subScores ( ) {
953
963
return {
954
- "First" : this . firstIteration ,
955
- "Worst" : this . worst4 ,
956
- "Average" : this . average ,
964
+ "First" : this . firstIterationScore ,
965
+ "Worst" : this . worst4Score ,
966
+ "Average" : this . averageScore ,
957
967
} ;
958
968
}
959
969
@@ -969,20 +979,20 @@ class DefaultBenchmark extends Benchmark {
969
979
super . updateUIAfterRun ( ) ;
970
980
971
981
if ( isInBrowser ) {
972
- document . getElementById ( firstID ( this ) ) . innerHTML = uiFriendlyNumber ( this . firstIteration ) ;
973
- document . getElementById ( worst4ID ( this ) ) . innerHTML = uiFriendlyNumber ( this . worst4 ) ;
974
- document . getElementById ( avgID ( this ) ) . innerHTML = uiFriendlyNumber ( this . average ) ;
975
- document . getElementById ( scoreID ( this ) ) . innerHTML = uiFriendlyNumber ( this . score ) ;
982
+ document . getElementById ( firstID ( this ) ) . innerHTML = uiFriendlyScore ( this . firstIterationScore ) ;
983
+ document . getElementById ( worst4ID ( this ) ) . innerHTML = uiFriendlyScore ( this . worst4Score ) ;
984
+ document . getElementById ( avgID ( this ) ) . innerHTML = uiFriendlyScore ( this . averageScore ) ;
985
+ document . getElementById ( scoreID ( this ) ) . innerHTML = uiFriendlyScore ( this . score ) ;
976
986
return ;
977
987
}
978
988
979
989
if ( dumpJSONResults )
980
990
return ;
981
991
982
- console . log ( " Startup:" , uiFriendlyNumber ( this . firstIteration ) ) ;
983
- console . log ( " Worst Case:" , uiFriendlyNumber ( this . worst4 ) ) ;
984
- console . log ( " Average:" , uiFriendlyNumber ( this . average ) ) ;
985
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
992
+ console . log ( " Startup:" , uiFriendlyScore ( this . firstIterationScore ) ) ;
993
+ console . log ( " Worst Case:" , uiFriendlyScore ( this . worst4Score ) ) ;
994
+ console . log ( " Average:" , uiFriendlyScore ( this . averageScore ) ) ;
995
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
986
996
if ( RAMification ) {
987
997
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
988
998
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
@@ -1106,17 +1116,21 @@ class WSLBenchmark extends Benchmark {
1106
1116
constructor ( ...args ) {
1107
1117
super ( ...args ) ;
1108
1118
1109
- this . stdlib = null ;
1110
- this . mainRun = null ;
1119
+ this . stdlibTime = null ;
1120
+ this . stdlibScore = null ;
1121
+ this . mainRunTime = null ;
1122
+ this . mainRunScore = null ;
1111
1123
}
1112
1124
1113
1125
processResults ( results ) {
1114
- this . stdlib = toScore ( results [ 0 ] ) ;
1115
- this . mainRun = toScore ( results [ 1 ] ) ;
1126
+ this . stdlibTime = results [ 0 ] ;
1127
+ this . stdlibScore = toScore ( results [ 0 ] ) ;
1128
+ this . mainRunTime = results [ 1 ] ;
1129
+ this . mainRunScore = toScore ( results [ 1 ] ) ;
1116
1130
}
1117
1131
1118
1132
get score ( ) {
1119
- return geomean ( [ this . stdlib , this . mainRun ] ) ;
1133
+ return geomean ( [ this . stdlibScore , this . mainRunScore ] ) ;
1120
1134
}
1121
1135
1122
1136
get runnerCode ( ) {
@@ -1139,10 +1153,10 @@ class WSLBenchmark extends Benchmark {
1139
1153
` ;
1140
1154
}
1141
1155
1142
- subTimes ( ) {
1156
+ subScores ( ) {
1143
1157
return {
1144
- "Stdlib" : this . stdlib ,
1145
- "MainRun" : this . mainRun ,
1158
+ "Stdlib" : this . stdlibScore ,
1159
+ "MainRun" : this . mainRunScore ,
1146
1160
} ;
1147
1161
}
1148
1162
@@ -1158,18 +1172,18 @@ class WSLBenchmark extends Benchmark {
1158
1172
super . updateUIAfterRun ( ) ;
1159
1173
1160
1174
if ( isInBrowser ) {
1161
- document . getElementById ( "wsl-stdlib-score" ) . innerHTML = uiFriendlyNumber ( this . stdlib ) ;
1162
- document . getElementById ( "wsl-tests-score" ) . innerHTML = uiFriendlyNumber ( this . mainRun ) ;
1163
- document . getElementById ( "wsl-score-score" ) . innerHTML = uiFriendlyNumber ( this . score ) ;
1175
+ document . getElementById ( "wsl-stdlib-score" ) . innerHTML = uiFriendlyScore ( this . stdlibScore ) ;
1176
+ document . getElementById ( "wsl-tests-score" ) . innerHTML = uiFriendlyScore ( this . mainRunScore ) ;
1177
+ document . getElementById ( "wsl-score-score" ) . innerHTML = uiFriendlyScore ( this . score ) ;
1164
1178
return ;
1165
1179
}
1166
1180
1167
1181
if ( dumpJSONResults )
1168
1182
return ;
1169
1183
1170
- console . log ( " Stdlib:" , uiFriendlyNumber ( this . stdlib ) ) ;
1171
- console . log ( " Tests:" , uiFriendlyNumber ( this . mainRun ) ) ;
1172
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
1184
+ console . log ( " Stdlib:" , uiFriendlyScore ( this . stdlibScore ) ) ;
1185
+ console . log ( " Tests:" , uiFriendlyScore ( this . mainRunScore ) ) ;
1186
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
1173
1187
if ( RAMification ) {
1174
1188
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1175
1189
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
@@ -1183,16 +1197,20 @@ class WasmLegacyBenchmark extends Benchmark {
1183
1197
super ( ...args ) ;
1184
1198
1185
1199
this . startupTime = null ;
1200
+ this . startupScore = null ;
1186
1201
this . runTime = null ;
1202
+ this . runScore = null ;
1187
1203
}
1188
1204
1189
1205
processResults ( results ) {
1190
- this . startupTime = toScore ( results [ 0 ] ) ;
1191
- this . runTime = toScore ( results [ 1 ] ) ;
1206
+ this . startupTime = results [ 0 ] ;
1207
+ this . startupScore = toScore ( results [ 0 ] ) ;
1208
+ this . runTime = results [ 1 ] ;
1209
+ this . runScore = toScore ( results [ 1 ] ) ;
1192
1210
}
1193
1211
1194
1212
get score ( ) {
1195
- return geomean ( [ this . startupTime , this . runTime ] ) ;
1213
+ return geomean ( [ this . startupScore , this . runScore ] ) ;
1196
1214
}
1197
1215
1198
1216
get prerunCode ( ) {
@@ -1311,10 +1329,10 @@ class WasmLegacyBenchmark extends Benchmark {
1311
1329
return str ;
1312
1330
}
1313
1331
1314
- subTimes ( ) {
1332
+ subScores ( ) {
1315
1333
return {
1316
- "Startup" : this . startupTime ,
1317
- "Runtime" : this . runTime ,
1334
+ "Startup" : this . startupScore ,
1335
+ "Runtime" : this . runScore ,
1318
1336
} ;
1319
1337
}
1320
1338
@@ -1340,18 +1358,18 @@ class WasmLegacyBenchmark extends Benchmark {
1340
1358
super . updateUIAfterRun ( ) ;
1341
1359
1342
1360
if ( isInBrowser ) {
1343
- document . getElementById ( this . startupID ) . innerHTML = uiFriendlyNumber ( this . startupTime ) ;
1344
- document . getElementById ( this . runID ) . innerHTML = uiFriendlyNumber ( this . runTime ) ;
1345
- document . getElementById ( this . scoreID ) . innerHTML = uiFriendlyNumber ( this . score ) ;
1361
+ document . getElementById ( this . startupID ) . innerHTML = uiFriendlyScore ( this . startupScore ) ;
1362
+ document . getElementById ( this . runID ) . innerHTML = uiFriendlyScore ( this . runScore ) ;
1363
+ document . getElementById ( this . scoreID ) . innerHTML = uiFriendlyScore ( this . score ) ;
1346
1364
return ;
1347
1365
}
1348
1366
1349
1367
if ( dumpJSONResults )
1350
1368
return ;
1351
1369
1352
- console . log ( " Startup:" , uiFriendlyNumber ( this . startupTime ) ) ;
1353
- console . log ( " Run time:" , uiFriendlyNumber ( this . runTime ) ) ;
1354
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
1370
+ console . log ( " Startup:" , uiFriendlyScore ( this . startupScore ) ) ;
1371
+ console . log ( " Run time:" , uiFriendlyScore ( this . runScore ) ) ;
1372
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
1355
1373
if ( RAMification ) {
1356
1374
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1357
1375
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
0 commit comments