Skip to content

Commit

Permalink
test(NODE-6323): add performance no-op baseline test (#4194)
Browse files Browse the repository at this point in the history
  • Loading branch information
nbbeeken authored Sep 11, 2024
1 parent 833eaa4 commit 8347db9
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/benchmarks/mongoBench/suites/singleBench.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,30 @@ const {

function makeSingleBench(suite) {
suite
.benchmark('returnDocument', benchmark =>
benchmark
.taskSize(1.531e-3) // One tweet is 1,531 bytes or 0.001531 MB
.setup(makeLoadJSON('tweet.json'))
.task(async function () {
return this.doc;
})
)
.benchmark('ping', benchmark =>
benchmark
.taskSize(0.15) // { ping: 1 } is 15 bytes of BSON x 10,000 iterations
.setup(makeClient)
.setup(connectClient)
.setup(initDb)
.task(async function () {
for (let i = 0; i < 10000; ++i) {
await this.db.command({ ping: 1 });
}
})
.teardown(disconnectClient)
)
.benchmark('runCommand', benchmark =>
benchmark
// { hello: true } is 13 bytes. However the legacy hello was 16 bytes, to preserve history comparison data we leave this value as is.
.taskSize(0.16)
.setup(makeClient)
.setup(connectClient)
Expand Down

0 comments on commit 8347db9

Please sign in to comment.