From 8347db9c0bb55d2416c40fe1638697719b9e5a96 Mon Sep 17 00:00:00 2001 From: Neal Beeken Date: Wed, 11 Sep 2024 15:03:50 -0400 Subject: [PATCH] test(NODE-6323): add performance no-op baseline test (#4194) --- .../mongoBench/suites/singleBench.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/benchmarks/mongoBench/suites/singleBench.js b/test/benchmarks/mongoBench/suites/singleBench.js index d38bc287f3..d7c8054fea 100644 --- a/test/benchmarks/mongoBench/suites/singleBench.js +++ b/test/benchmarks/mongoBench/suites/singleBench.js @@ -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)