Skip to content

Commit 363cc92

Browse files
committed
Better concurrent benchmarks
1 parent 2f2536c commit 363cc92

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

test/performance/async_perf_test.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ class TestRunCommand80Tasks(TestRunCommand):
221221
n_tasks = 80
222222

223223

224-
class TestRunCommandManyTasks(TestRunCommand):
224+
class TestRunCommandUnlimitedTasks(TestRunCommand):
225225
async def do_task(self):
226226
command = self.client.perftest.command
227227
await asyncio.gather(*[command("hello", True) for _ in range(NUM_DOCS)])
@@ -283,7 +283,7 @@ class TestFindOneByID80Tasks(TestFindOneByID):
283283
n_tasks = 80
284284

285285

286-
class TestFindOneByIDManyTasks(TestFindOneByID):
286+
class TestFindOneByIDUnlimitedTasks(TestFindOneByID):
287287
async def do_task(self):
288288
find_one = self.corpus.find_one
289289
await asyncio.gather(*[find_one({"_id": _id}) for _id in self.inserted_ids])
@@ -308,6 +308,13 @@ async def asyncSetUp(self):
308308

309309

310310
class TestSmallDocInsertOne(SmallDocInsertTest, AsyncPyMongoTestCase):
311+
async def do_task(self):
312+
insert_one = self.corpus.insert_one
313+
for doc in self.documents:
314+
await insert_one(doc)
315+
316+
317+
class TestSmallDocInsertOneUnlimitedTasks(SmallDocInsertTest, AsyncPyMongoTestCase):
311318
async def do_task(self):
312319
insert_one = self.corpus.insert_one
313320
await asyncio.gather(*[insert_one(doc) for doc in self.documents])
@@ -324,6 +331,13 @@ async def asyncSetUp(self):
324331

325332

326333
class TestLargeDocInsertOne(LargeDocInsertTest, AsyncPyMongoTestCase):
334+
async def do_task(self):
335+
insert_one = self.corpus.insert_one
336+
for doc in self.documents:
337+
await insert_one(doc)
338+
339+
340+
class TestLargeDocInsertOneUnlimitedTasks(LargeDocInsertTest, AsyncPyMongoTestCase):
327341
async def do_task(self):
328342
insert_one = self.corpus.insert_one
329343
await asyncio.gather(*[insert_one(doc) for doc in self.documents])
@@ -343,10 +357,6 @@ class TestFindManyAndEmptyCursor80Tasks(TestFindManyAndEmptyCursor):
343357
n_tasks = 80
344358

345359

346-
class TestFindManyAndEmptyCursorManyTasks(TestFindManyAndEmptyCursor):
347-
n_tasks = 1000
348-
349-
350360
class TestSmallDocBulkInsert(SmallDocInsertTest, AsyncPyMongoTestCase):
351361
async def do_task(self):
352362
await self.corpus.insert_many(self.documents, ordered=True)

0 commit comments

Comments
 (0)