Skip to content

Commit 96760f7

Browse files
committed
chore: add toArray benchmark
1 parent dc59e88 commit 96760f7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

packages/driver-bench/src/cli.mts

+2-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ MONGODB_URI = MONGODB_URI.length === 0 ? 'mongodb://127.0.0.1:27017' : MONGODB_U
4343

4444
const client = new mongodbDriver.MongoClient(MONGODB_URI, { serverSelectionTimeoutMS: 2000 });
4545
try {
46-
await client.db().command({ ping: 1 });
46+
console.log('server version', (await client.db('admin').command({ buildInfo: 1 })).version);
47+
// console.log(await client.db('admin').command({ getParameter: '*' }));
4748
await client.close();
4849
console.log(`Benching driver at: ${driverPath}`);
4950
console.log(systemInfo());

packages/driver-bench/src/mongoBench/suites/multiBench.mts

+16
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,21 @@ export function makeMultiBench(suite: Suite, mongodbDriver): Suite {
141141
})
142142
.teardown(dropDb)
143143
.teardown(disconnectClient)
144+
)
145+
.benchmark('findManyAndToArray', benchmark =>
146+
benchmark
147+
.taskSize(16.22)
148+
.setup(makeLoadJSON('tweet.json'))
149+
.setup(makeMakeClient(mongodbDriver))
150+
.setup(connectClient)
151+
.setup(initDb)
152+
.setup(dropDb)
153+
.setup(initCollection)
154+
.setup(makeLoadTweets(false))
155+
.task(async function () {
156+
await this.collection.find({}).toArray();
157+
})
158+
.teardown(dropDb)
159+
.teardown(disconnectClient)
144160
);
145161
}

0 commit comments

Comments
 (0)