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-4991 Fix perf client.bulkWrite perf regression #2056

Closed
wants to merge 1 commit into from

Conversation

ShaneHarvey
Copy link
Member

@ShaneHarvey ShaneHarvey commented Jan 10, 2025

PYTHON-4991 Fix perf client.bulkWrite perf regression

Explanation: I noticed that the perf regression applied equally to both small and large documents which wouldn't make sense if the overhead was only attributed to the allocation cost of ChainMaps. For this regression to apply to larger documents, that must mean that there's also a performance cost when iterating over the ChainMap in the encoding step (something I had not expected).

Instead we can encode the document directly so that it gets recognized as a "top-level" document, then the existing _id reordering logic will be applied. Running the perf tests on this PR will confirm.

Perf task running here: https://spruce.mongodb.com/task/mongo_python_driver_perf_tests_perf_8.0_standalone_patch_493fc2ab3e237c2155fde4400002ed2aafe9b2be_67817f2e6497de0007ec294b_25_01_10_20_12_36/logs?execution=0

@ShaneHarvey
Copy link
Member Author

Results of this change:
The perf regression for large documents is fixed but for small documents there's still a ~20% regression compare to pre-PYTHON-4915. Therefor I think we should go ahead and revert PYTHON-4915.

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.

1 participant