Details
-
Improvement
-
Status: Closed
-
Minor - P4
-
Resolution: Fixed
-
None
-
None
-
None
Description
When decoding a BSON string the generation of ObjectIds could be optimized to avoid several function calls.
For example, instead of creating ObjectIds the BSON decoder could create objects of this class:
class _ObjectIdFromString(ObjectId):
|
def __init__(self, oid):
|
self._ObjectId__id = oid
|
This new class is just providing a simplification of ObjectId.__init__ for the case when the input is known to be a sequence of 12 bytes.
The changes to the c extension would be trivial, the attached patch file shows the 4 lines that require changes.