@@ -18,6 +18,7 @@ import {
1818 MONGODB_DRIVER_PATH ,
1919 MONGODB_DRIVER_REVISION ,
2020 MONGODB_DRIVER_VERSION ,
21+ NORMALIZED_PING_SCALING_CONST ,
2122 snakeToCamel
2223} from './driver.mjs' ;
2324
@@ -203,38 +204,28 @@ function calculateNormalizedResults(results: MetricInfo[]): MetricInfo[] {
203204 const pingBench = results . find ( r => r . info . test_name === 'ping' ) ;
204205
205206 if ( pingBench ) {
206- const newMetrics : MetricInfo [ ] = [ ] ;
207207 const pingThroughput = pingBench . metrics [ 0 ] . value ;
208208 for ( const bench of results ) {
209- if ( bench . info . test_name === 'primes' ) {
210- newMetrics . push ( { ...bench } ) ;
211- }
212- else if ( bench . info . test_name === 'ping' ) {
209+ if ( bench . info . test_name === 'ping' ) {
213210 // Compute ping's normalized_throughput against the primes bench if present
214211 if ( primesBench ) {
215212 const primesThroughput = primesBench . metrics [ 0 ] . value ;
216- const normalizedThroughput : Metric = { 'name' : 'normalized_throughput' , value : bench . metrics [ 0 ] . value / primesThroughput } ;
217- const newInfo : MetricInfo = { info : { ...bench . info } , metrics : [ ...bench . metrics , normalizedThroughput ] } ;
218- newMetrics . push ( newInfo ) ;
219- } else {
220- newMetrics . push ( { ...bench } ) ;
213+ const normalizedThroughput : Metric = { 'name' : 'normalized_throughput' , value : NORMALIZED_PING_SCALING_CONST * bench . metrics [ 0 ] . value / primesThroughput } ;
214+ bench . metrics . push ( normalizedThroughput ) ;
221215 }
222216 } else {
223217 // Compute normalized_throughput of benchmarks against ping bench
224218 const normalizedThroughput : Metric = { 'name' : 'normalized_throughput' , value : bench . metrics [ 0 ] . value / pingThroughput } ;
225- const newInfo : MetricInfo = { info : { ...bench . info } , metrics : [ ...bench . metrics , normalizedThroughput ] }
226- newMetrics . push ( newInfo ) ;
219+ bench . metrics . push ( normalizedThroughput ) ;
227220 }
228221 }
229-
230- return newMetrics ;
231222 }
232223
233224 return results ;
234225}
235226
236- results = calculateNormalizedResults ( results ) ;
237227results = calculateCompositeBenchmarks ( results ) ;
228+ results = calculateNormalizedResults ( results ) ;
238229
239230
240231await fs . writeFile ( 'results.json' , JSON . stringify ( results , undefined , 2 ) , 'utf8' ) ;
0 commit comments