[Python-Dev] Micro-benchmarks for PEP 580
vstinner at redhat.com
Tue Jul 10 18:47:08 EDT 2018
2018-07-10 14:59 GMT+02:00 INADA Naoki <songofacandy at gmail.com>:
> PyObject_CallFunction(func, "n", 42);
> Currently, we create temporary long object for passing argument.
> If there is protocol for exposeing format used by PyArg_Parse*, we can
> bypass temporal Python object and call myfunc_impl directly.
I'm not sure that it's worth it. It seems complex to implement.
I proposed something simpler, but nobody tried to implement it.
Instead of calling the long and complex PyArg_Parse...() functions,
why not generating C code to parse arguments instead? The idea looks
like "inlining" PyArg_Parse...() in its caller, but technically it
means that Argument Clinic generates C code to parse arguments.
PyArg_Parse...() is cheap and has been optimized, but on very fast
functions (less than 100 ns), it might be significant. Well, to be
sure, someone should run a benchmark :-)
More information about the Python-Dev