-
Type:
Improvement
-
Resolution: Done
-
Priority:
Minor - P4
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
-
None
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.