@@ -59,7 +59,7 @@ function displayCategoryScores() {
59
59
60
60
let summaryElement = document . getElementById ( "result-summary" ) ;
61
61
for ( let [ category , scores ] of categoryScores )
62
- summaryElement . innerHTML += `<p> ${ category } : ${ uiFriendlyNumber ( geomean ( scores ) ) } </p>`
62
+ summaryElement . innerHTML += `<p> ${ category } : ${ uiFriendlyScore ( geomean ( scores ) ) } </p>`
63
63
64
64
categoryScores = null ;
65
65
}
@@ -153,6 +153,10 @@ function uiFriendlyNumber(num) {
153
153
return num . toFixed ( 3 ) ;
154
154
}
155
155
156
+ function uiFriendlyScore ( num ) {
157
+ return uiFriendlyNumber ( num ) ;
158
+ }
159
+
156
160
function uiFriendlyDuration ( time )
157
161
{
158
162
const minutes = time . getMinutes ( ) ;
@@ -280,30 +284,30 @@ class Driver {
280
284
281
285
categoryScores = new Map ;
282
286
for ( const benchmark of this . benchmarks ) {
283
- for ( let category of Object . keys ( benchmark . subTimes ( ) ) )
287
+ for ( let category of Object . keys ( benchmark . subScores ( ) ) )
284
288
categoryScores . set ( category , [ ] ) ;
285
289
}
286
290
287
291
for ( const benchmark of this . benchmarks ) {
288
- for ( let [ category , value ] of Object . entries ( benchmark . subTimes ( ) ) ) {
292
+ for ( let [ category , value ] of Object . entries ( benchmark . subScores ( ) ) ) {
289
293
const arr = categoryScores . get ( category ) ;
290
294
arr . push ( value ) ;
291
295
}
292
296
}
293
297
294
298
if ( isInBrowser ) {
295
299
summaryElement . classList . add ( 'done' ) ;
296
- summaryElement . innerHTML = "<div class=\"score\">" + uiFriendlyNumber ( geomean ( allScores ) ) + "</div><label>Score</label>" ;
300
+ summaryElement . innerHTML = "<div class=\"score\">" + uiFriendlyScore ( geomean ( allScores ) ) + "</div><label>Score</label>" ;
297
301
summaryElement . onclick = displayCategoryScores ;
298
302
if ( showScoreDetails )
299
303
displayCategoryScores ( ) ;
300
304
statusElement . innerHTML = '' ;
301
305
} else if ( ! dumpJSONResults ) {
302
306
console . log ( "\n" ) ;
303
307
for ( let [ category , scores ] of categoryScores )
304
- console . log ( `${ category } : ${ uiFriendlyNumber ( geomean ( scores ) ) } ` ) ;
308
+ console . log ( `${ category } : ${ uiFriendlyScore ( geomean ( scores ) ) } ` ) ;
305
309
306
- console . log ( "\nTotal Score: " , uiFriendlyNumber ( geomean ( allScores ) ) , "\n" ) ;
310
+ console . log ( "\nTotal Score: " , uiFriendlyScore ( geomean ( allScores ) ) , "\n" ) ;
307
311
}
308
312
309
313
this . reportScoreToRunBenchmarkRunner ( ) ;
@@ -472,9 +476,9 @@ class Driver {
472
476
const results = { } ;
473
477
for ( const benchmark of this . benchmarks ) {
474
478
const subResults = { }
475
- const subTimes = benchmark . subTimes ( ) ;
476
- for ( const name in subTimes ) {
477
- subResults [ name ] = { "metrics" : { "Time" : { "current" : [ toTimeValue ( subTimes [ name ] ) ] } } } ;
479
+ const subScores = benchmark . subScores ( ) ;
480
+ for ( const name in subScores ) {
481
+ subResults [ name ] = { "metrics" : { "Time" : { "current" : [ toTimeValue ( subScores [ name ] ) ] } } } ;
478
482
}
479
483
results [ benchmark . name ] = {
480
484
"metrics" : {
@@ -889,9 +893,12 @@ class DefaultBenchmark extends Benchmark {
889
893
super ( ...args ) ;
890
894
891
895
this . worstCaseCount = getWorstCaseCount ( this . plan ) ;
892
- this . firstIteration = null ;
893
- this . worst4 = null ;
894
- this . average = null ;
896
+ this . firstIterationTime = null ;
897
+ this . firstIterationScore = null ;
898
+ this . worst4Time = null ;
899
+ this . worst4Score = null ;
900
+ this . averageTime = null ;
901
+ this . averageScore = null ;
895
902
896
903
assert ( this . iterations > this . worstCaseCount ) ;
897
904
}
@@ -905,7 +912,8 @@ class DefaultBenchmark extends Benchmark {
905
912
}
906
913
results = copyArray ( results ) ;
907
914
908
- this . firstIteration = toScore ( results [ 0 ] ) ;
915
+ this . firstIterationTime = results [ 0 ] ;
916
+ this . firstIterationScore = toScore ( results [ 0 ] ) ;
909
917
910
918
results = results . slice ( 1 ) ;
911
919
results . sort ( ( a , b ) => a < b ? 1 : - 1 ) ;
@@ -915,19 +923,21 @@ class DefaultBenchmark extends Benchmark {
915
923
const worstCase = [ ] ;
916
924
for ( let i = 0 ; i < this . worstCaseCount ; ++ i )
917
925
worstCase . push ( results [ i ] ) ;
918
- this . worst4 = toScore ( mean ( worstCase ) ) ;
919
- this . average = toScore ( mean ( results ) ) ;
926
+ this . worst4Time = mean ( worstCase ) ;
927
+ this . worst4Score = toScore ( this . worst4Time ) ;
928
+ this . averageTime = mean ( results ) ;
929
+ this . averageScore = toScore ( this . averageTime ) ;
920
930
}
921
931
922
932
get score ( ) {
923
- return geomean ( [ this . firstIteration , this . worst4 , this . average ] ) ;
933
+ return geomean ( [ this . firstIterationScore , this . worst4Score , this . averageScore ] ) ;
924
934
}
925
935
926
- subTimes ( ) {
936
+ subScores ( ) {
927
937
return {
928
- "First" : this . firstIteration ,
929
- "Worst" : this . worst4 ,
930
- "Average" : this . average ,
938
+ "First" : this . firstIterationScore ,
939
+ "Worst" : this . worst4Score ,
940
+ "Average" : this . averageScore ,
931
941
} ;
932
942
}
933
943
@@ -943,20 +953,20 @@ class DefaultBenchmark extends Benchmark {
943
953
super . updateUIAfterRun ( ) ;
944
954
945
955
if ( isInBrowser ) {
946
- document . getElementById ( firstID ( this ) ) . innerHTML = uiFriendlyNumber ( this . firstIteration ) ;
947
- document . getElementById ( worst4ID ( this ) ) . innerHTML = uiFriendlyNumber ( this . worst4 ) ;
948
- document . getElementById ( avgID ( this ) ) . innerHTML = uiFriendlyNumber ( this . average ) ;
949
- document . getElementById ( scoreID ( this ) ) . innerHTML = uiFriendlyNumber ( this . score ) ;
956
+ document . getElementById ( firstID ( this ) ) . innerHTML = uiFriendlyScore ( this . firstIterationScore ) ;
957
+ document . getElementById ( worst4ID ( this ) ) . innerHTML = uiFriendlyScore ( this . worst4Score ) ;
958
+ document . getElementById ( avgID ( this ) ) . innerHTML = uiFriendlyScore ( this . averageScore ) ;
959
+ document . getElementById ( scoreID ( this ) ) . innerHTML = uiFriendlyScore ( this . score ) ;
950
960
return ;
951
961
}
952
962
953
963
if ( dumpJSONResults )
954
964
return ;
955
965
956
- console . log ( " Startup:" , uiFriendlyNumber ( this . firstIteration ) ) ;
957
- console . log ( " Worst Case:" , uiFriendlyNumber ( this . worst4 ) ) ;
958
- console . log ( " Average:" , uiFriendlyNumber ( this . average ) ) ;
959
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
966
+ console . log ( " Startup:" , uiFriendlyScore ( this . firstIterationScore ) ) ;
967
+ console . log ( " Worst Case:" , uiFriendlyScore ( this . worst4Score ) ) ;
968
+ console . log ( " Average:" , uiFriendlyScore ( this . averageScore ) ) ;
969
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
960
970
if ( RAMification ) {
961
971
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
962
972
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
@@ -990,17 +1000,21 @@ class WSLBenchmark extends Benchmark {
990
1000
constructor ( ...args ) {
991
1001
super ( ...args ) ;
992
1002
993
- this . stdlib = null ;
994
- this . mainRun = null ;
1003
+ this . stdlibTime = null ;
1004
+ this . stdlibScore = null ;
1005
+ this . mainRunTime = null ;
1006
+ this . mainRunScore = null ;
995
1007
}
996
1008
997
1009
processResults ( results ) {
998
- this . stdlib = toScore ( results [ 0 ] ) ;
999
- this . mainRun = toScore ( results [ 1 ] ) ;
1010
+ this . stdlibTime = results [ 0 ] ;
1011
+ this . stdlibScore = toScore ( results [ 0 ] ) ;
1012
+ this . mainRunTime = results [ 1 ] ;
1013
+ this . mainRunScore = toScore ( results [ 1 ] ) ;
1000
1014
}
1001
1015
1002
1016
get score ( ) {
1003
- return geomean ( [ this . stdlib , this . mainRun ] ) ;
1017
+ return geomean ( [ this . stdlibScore , this . mainRunScore ] ) ;
1004
1018
}
1005
1019
1006
1020
get runnerCode ( ) {
@@ -1023,10 +1037,10 @@ class WSLBenchmark extends Benchmark {
1023
1037
` ;
1024
1038
}
1025
1039
1026
- subTimes ( ) {
1040
+ subScores ( ) {
1027
1041
return {
1028
- "Stdlib" : this . stdlib ,
1029
- "MainRun" : this . mainRun ,
1042
+ "Stdlib" : this . stdlibScore ,
1043
+ "MainRun" : this . mainRunScore ,
1030
1044
} ;
1031
1045
}
1032
1046
@@ -1042,18 +1056,18 @@ class WSLBenchmark extends Benchmark {
1042
1056
super . updateUIAfterRun ( ) ;
1043
1057
1044
1058
if ( isInBrowser ) {
1045
- document . getElementById ( "wsl-stdlib-score" ) . innerHTML = uiFriendlyNumber ( this . stdlib ) ;
1046
- document . getElementById ( "wsl-tests-score" ) . innerHTML = uiFriendlyNumber ( this . mainRun ) ;
1047
- document . getElementById ( "wsl-score-score" ) . innerHTML = uiFriendlyNumber ( this . score ) ;
1059
+ document . getElementById ( "wsl-stdlib-score" ) . innerHTML = uiFriendlyScore ( this . stdlibScore ) ;
1060
+ document . getElementById ( "wsl-tests-score" ) . innerHTML = uiFriendlyScore ( this . mainRunScore ) ;
1061
+ document . getElementById ( "wsl-score-score" ) . innerHTML = uiFriendlyScore ( this . score ) ;
1048
1062
return ;
1049
1063
}
1050
1064
1051
1065
if ( dumpJSONResults )
1052
1066
return ;
1053
1067
1054
- console . log ( " Stdlib:" , uiFriendlyNumber ( this . stdlib ) ) ;
1055
- console . log ( " Tests:" , uiFriendlyNumber ( this . mainRun ) ) ;
1056
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
1068
+ console . log ( " Stdlib:" , uiFriendlyScore ( this . stdlibScore ) ) ;
1069
+ console . log ( " Tests:" , uiFriendlyScore ( this . mainRunScore ) ) ;
1070
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
1057
1071
if ( RAMification ) {
1058
1072
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1059
1073
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
@@ -1067,16 +1081,20 @@ class WasmBenchmark extends Benchmark {
1067
1081
super ( ...args ) ;
1068
1082
1069
1083
this . startupTime = null ;
1084
+ this . startupScore = null ;
1070
1085
this . runTime = null ;
1086
+ this . runScore = null ;
1071
1087
}
1072
1088
1073
1089
processResults ( results ) {
1074
- this . startupTime = toScore ( results [ 0 ] ) ;
1075
- this . runTime = toScore ( results [ 1 ] ) ;
1090
+ this . startupTime = results [ 0 ] ;
1091
+ this . startupScore = toScore ( results [ 0 ] ) ;
1092
+ this . runTime = results [ 1 ] ;
1093
+ this . runScore = toScore ( results [ 1 ] ) ;
1076
1094
}
1077
1095
1078
1096
get score ( ) {
1079
- return geomean ( [ this . startupTime , this . runTime ] ) ;
1097
+ return geomean ( [ this . startupScore , this . runScore ] ) ;
1080
1098
}
1081
1099
1082
1100
get prerunCode ( ) {
@@ -1194,10 +1212,10 @@ class WasmBenchmark extends Benchmark {
1194
1212
return str ;
1195
1213
}
1196
1214
1197
- subTimes ( ) {
1215
+ subScores ( ) {
1198
1216
return {
1199
- "Startup" : this . startupTime ,
1200
- "Runtime" : this . runTime ,
1217
+ "Startup" : this . startupScore ,
1218
+ "Runtime" : this . runScore ,
1201
1219
} ;
1202
1220
}
1203
1221
@@ -1223,22 +1241,22 @@ class WasmBenchmark extends Benchmark {
1223
1241
super . updateUIAfterRun ( ) ;
1224
1242
1225
1243
if ( isInBrowser ) {
1226
- document . getElementById ( this . startupID ) . innerHTML = uiFriendlyNumber ( this . startupTime ) ;
1227
- document . getElementById ( this . runID ) . innerHTML = uiFriendlyNumber ( this . runTime ) ;
1228
- document . getElementById ( this . scoreID ) . innerHTML = uiFriendlyNumber ( this . score ) ;
1244
+ document . getElementById ( this . startupID ) . innerHTML = uiFriendlyScore ( this . startupScore ) ;
1245
+ document . getElementById ( this . runID ) . innerHTML = uiFriendlyScore ( this . runScore ) ;
1246
+ document . getElementById ( this . scoreID ) . innerHTML = uiFriendlyScore ( this . score ) ;
1229
1247
return ;
1230
1248
}
1231
1249
1232
1250
if ( dumpJSONResults )
1233
1251
return ;
1234
1252
1235
- console . log ( " Startup:" , uiFriendlyNumber ( this . startupTime ) ) ;
1236
- console . log ( " Run time:" , uiFriendlyNumber ( this . runTime ) ) ;
1253
+ console . log ( " Startup:" , uiFriendlyScore ( this . startupScore ) ) ;
1254
+ console . log ( " Run time:" , uiFriendlyScore ( this . runScore ) ) ;
1237
1255
if ( RAMification ) {
1238
1256
console . log ( " Current Footprint:" , uiFriendlyNumber ( this . currentFootprint ) ) ;
1239
1257
console . log ( " Peak Footprint:" , uiFriendlyNumber ( this . peakFootprint ) ) ;
1240
1258
}
1241
- console . log ( " Score:" , uiFriendlyNumber ( this . score ) ) ;
1259
+ console . log ( " Score:" , uiFriendlyScore ( this . score ) ) ;
1242
1260
}
1243
1261
} ;
1244
1262
0 commit comments