Skip to content

Commit dcbf212

Browse files
committed
Add serial benchmarks
1 parent d8f57ac commit dcbf212

File tree

1 file changed

+18
-12
lines changed

1 file changed

+18
-12
lines changed

test/performance/async_perf_test.py

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -210,19 +210,24 @@ async def asyncSetUp(self):
210210

211211
async def do_task(self):
212212
command = self.client.perftest.command
213-
await asyncio.gather(*[command("hello", True) for _ in range(NUM_DOCS)])
213+
for _ in range(NUM_DOCS):
214+
await command("hello", True)
214215

215216

216217
class TestRunCommand8Tasks(TestRunCommand):
217218
n_tasks = 8
218219

220+
async def do_task(self):
221+
command = self.client.perftest.command
222+
await asyncio.gather(*[command("hello", True) for _ in range(NUM_DOCS)])
223+
219224

220225
class TestRunCommand80Tasks(TestRunCommand):
221226
n_tasks = 80
222227

223-
224-
# class TestRunCommand800Tasks(TestRunCommand):
225-
# n_tasks = 800
228+
async def do_task(self):
229+
command = self.client.perftest.command
230+
await asyncio.gather(*[command("hello", True) for _ in range(NUM_DOCS)])
226231

227232

228233
class TestDocument(PerformanceTest):
@@ -269,19 +274,24 @@ async def after(self):
269274
class TestFindOneByID(FindTest, AsyncPyMongoTestCase):
270275
async def do_task(self):
271276
find_one = self.corpus.find_one
272-
await asyncio.gather(*[find_one({"_id": _id}) for _id in self.inserted_ids])
277+
for _id in range(self.inserted_ids):
278+
await find_one({"_id": _id})
273279

274280

275281
class TestFindOneByID8Tasks(TestFindOneByID):
276282
n_tasks = 8
277283

284+
async def do_task(self):
285+
find_one = self.corpus.find_one
286+
await asyncio.gather(*[find_one({"_id": _id}) for _id in self.inserted_ids])
287+
278288

279289
class TestFindOneByID80Tasks(TestFindOneByID):
280290
n_tasks = 80
281291

282-
283-
# class TestFindOneByID800Tasks(TestFindOneByID):
284-
# n_tasks = 800
292+
async def do_task(self):
293+
find_one = self.corpus.find_one
294+
await asyncio.gather(*[find_one({"_id": _id}) for _id in self.inserted_ids])
285295

286296

287297
class SmallDocInsertTest(TestDocument):
@@ -338,10 +348,6 @@ class TestFindManyAndEmptyCursor80Tasks(TestFindManyAndEmptyCursor):
338348
n_tasks = 80
339349

340350

341-
# class TestFindManyAndEmptyCursor800Tasks(TestFindManyAndEmptyCursor):
342-
# n_tasks = 800
343-
344-
345351
class TestSmallDocBulkInsert(SmallDocInsertTest, AsyncPyMongoTestCase):
346352
async def do_task(self):
347353
await self.corpus.insert_many(self.documents, ordered=True)

0 commit comments

Comments
 (0)