-
Type: Improvement
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
The docs for PyObject_CallMethod say:
Note that if you only pass PyObject* args, PyObject_CallMethodObjArgs() is a faster alternative.
We use PyObject_CallMethod in a few places:
$ git grep PyObject_CallMethod bson/_cbsonmodule.c:1070: PyObject* as_doc = PyObject_CallMethod(value, "as_doc", NULL); bson/_cbsonmodule.c:1226: PyObject* utcoffset = PyObject_CallMethod(value, "utcoffset", NULL); bson/_cbsonmodule.c:1285: binary_value = PyObject_CallMethod(binary_type, "from_uuid", "(Oi)", value, options->uuid_rep); bson/_cbsonmodule.c:1983: value = PyObject_CallMethod(binary_value, "as_uuid", "(i)", uuid_rep); bson/_cbsonmodule.c:2468: value = PyObject_CallMethod(dec128,
Even thought they pass non-PyObject* args, we may be able to optimize the from_uuid/as_uuid calls too.