PYTHON-4833 - Add Collection bulk_write benchmarks (#2245)

This commit is contained in:
Noah Stapp 2025-03-28 13:48:46 -04:00 committed by GitHub
parent a0951515f4
commit f3ca1e0372
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 0 deletions

View File

@ -362,6 +362,17 @@ class TestSmallDocBulkInsert(SmallDocInsertTest, AsyncPyMongoTestCase):
await self.corpus.insert_many(self.documents, ordered=True)
class TestSmallDocCollectionBulkInsert(SmallDocInsertTest, AsyncPyMongoTestCase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.models = []
for doc in self.documents:
self.models.append(InsertOne(namespace="perftest.corpus", document=doc))
async def do_task(self):
await self.corpus.bulk_write(self.models, ordered=True)
class TestSmallDocClientBulkInsert(SmallDocInsertTest, AsyncPyMongoTestCase):
@async_client_context.require_version_min(8, 0, 0, -24)
async def asyncSetUp(self):
@ -412,6 +423,17 @@ class TestLargeDocBulkInsert(LargeDocInsertTest, AsyncPyMongoTestCase):
await self.corpus.insert_many(self.documents, ordered=True)
class TestLargeDocCollectionBulkInsert(LargeDocInsertTest, AsyncPyMongoTestCase):
async def asyncSetUp(self):
await super().asyncSetUp()
self.models = []
for doc in self.documents:
self.models.append(InsertOne(namespace="perftest.corpus", document=doc))
async def do_task(self):
await self.corpus.bulk_write(self.models, ordered=True)
class TestLargeDocClientBulkInsert(LargeDocInsertTest, AsyncPyMongoTestCase):
@async_client_context.require_version_min(8, 0, 0, -24)
async def asyncSetUp(self):

View File

@ -443,6 +443,17 @@ class TestSmallDocBulkInsert(SmallDocInsertTest, unittest.TestCase):
self.corpus.insert_many(self.documents, ordered=True)
class TestSmallDocCollectionBulkInsert(SmallDocInsertTest, unittest.TestCase):
def setUp(self):
super().setUp()
self.models = []
for doc in self.documents:
self.models.append(InsertOne(namespace="perftest.corpus", document=doc))
def do_task(self):
self.corpus.bulk_write(self.models, ordered=True)
class TestSmallDocClientBulkInsert(SmallDocInsertTest, unittest.TestCase):
@client_context.require_version_min(8, 0, 0, -24)
def setUp(self):
@ -493,6 +504,17 @@ class TestLargeDocBulkInsert(LargeDocInsertTest, unittest.TestCase):
self.corpus.insert_many(self.documents, ordered=True)
class TestLargeDocCollectionBulkInsert(LargeDocInsertTest, unittest.TestCase):
def setUp(self):
super().setUp()
self.models = []
for doc in self.documents:
self.models.append(InsertOne(namespace="perftest.corpus", document=doc))
def do_task(self):
self.corpus.bulk_write(self.models, ordered=True)
class TestLargeDocClientBulkInsert(LargeDocInsertTest, unittest.TestCase):
@client_context.require_version_min(8, 0, 0, -24)
def setUp(self):