Skip to content

Commit 2aa2f38

Browse files
committed
cleanup
1 parent 88294b3 commit 2aa2f38

File tree

2 files changed

+7
-16
lines changed

2 files changed

+7
-16
lines changed

test/benchmarks/driver_bench/src/main.mts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -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);
237227
results = calculateCompositeBenchmarks(results);
228+
results = calculateNormalizedResults(results);
238229

239230

240231
await fs.writeFile('results.json', JSON.stringify(results, undefined, 2), 'utf8');

test/benchmarks/driver_bench/src/suites/node_specific/ping.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { ALERT_TAG, driver, WRITE_TAG, type mongodb } from '../../driver.mjs';
1+
import { ALERT_TAG, driver, type mongodb } from '../../driver.mjs';
22

33
// { ping: 1 } is 15 bytes of BSON x 10,000 iterations
44
export const taskSize = 0.15;

0 commit comments

Comments
 (0)