-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Investigations into PYTHON-5211 have identified at least four optimizations to improve BSON encoding/decoding performance:
1. Skip _type_marker lookup for common built-in types.
2. Use PyDict_New() instead of PyObject_CallObject() where possible.
3. Use PyDict_SetItem() instead of PyObject_SetItem() where possible.
4. Use PyObject_Vectorcall() and its ilk instead of PyObject_CallFunctionObjArgs() and similar functions.
These four together improve performance by up to ~25% on our encoding and decoding BSON benchmarks consistently across Python versions.
- is related to
-
PYTHON-5211 BSON performance regression in Python 3.12
-
- Closed
-