Skip to content

Commit 8347db9

Browse files
authored
test(NODE-6323): add performance no-op baseline test (#4194)
1 parent 833eaa4 commit 8347db9

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/benchmarks/mongoBench/suites/singleBench.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,30 @@ const {
1313

1414
function makeSingleBench(suite) {
1515
suite
16+
.benchmark('returnDocument', benchmark =>
17+
benchmark
18+
.taskSize(1.531e-3) // One tweet is 1,531 bytes or 0.001531 MB
19+
.setup(makeLoadJSON('tweet.json'))
20+
.task(async function () {
21+
return this.doc;
22+
})
23+
)
24+
.benchmark('ping', benchmark =>
25+
benchmark
26+
.taskSize(0.15) // { ping: 1 } is 15 bytes of BSON x 10,000 iterations
27+
.setup(makeClient)
28+
.setup(connectClient)
29+
.setup(initDb)
30+
.task(async function () {
31+
for (let i = 0; i < 10000; ++i) {
32+
await this.db.command({ ping: 1 });
33+
}
34+
})
35+
.teardown(disconnectClient)
36+
)
1637
.benchmark('runCommand', benchmark =>
1738
benchmark
39+
// { hello: true } is 13 bytes. However the legacy hello was 16 bytes, to preserve history comparison data we leave this value as is.
1840
.taskSize(0.16)
1941
.setup(makeClient)
2042
.setup(connectClient)

0 commit comments

Comments
 (0)