Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PYTHON-4347 Improve performance by only calling get_topology once #1673

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

ShaneHarvey
Copy link
Member

@ShaneHarvey ShaneHarvey commented Jun 11, 2024

https://jira.mongodb.org/browse/PYTHON-4347

TODO:

  • Benchmark locally
(pymongo-py39) ➜  mongo-python-driver git:(PYTHON-4347-simple) python bench-command.py 100
Python: 3.9.13, PyMongo: 4.8.0.dev1, MongoDB: 5.0.15
Running 10000 operations across 100 thread(s)
command: 1.09s
find_one: 1.42s
insert_one: 1.29s

vs master:

$ python bench-command.py 100
Python: 3.9.13, PyMongo: 4.8.0.dev1, MongoDB: 5.0.15
Running 10000 operations across 100 thread(s)
command: 1.26s
find_one: 1.51s
insert_one: 1.34s

1 thread:

(pymongo-py39) ➜  mongo-python-driver git:(PYTHON-4347-simple) python bench-command.py 1  
Python: 3.9.13, PyMongo: 4.8.0.dev1, MongoDB: 5.0.15
Running 10000 operations across 1 thread(s)
command: 1.25s
find_one: 1.86s
insert_one: 1.81s

vs master:

python bench-command.py 1
Python: 3.9.13, PyMongo: 4.8.0.dev1, MongoDB: 5.0.15
Running 10000 operations across 1 thread(s)
command: 1.42s
find_one: 1.99s
insert_one: 1.89s
Screenshot 2024-06-11 at 4 51 14 PM

Copy link
Contributor

@caseyclements caseyclements left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShaneHarvey ShaneHarvey merged commit 5dd6ffb into mongodb:master Jun 12, 2024
33 of 35 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants