[issue28839] _PyFunction_FastCallDict(): replace PyTuple_New() with PyMem_Malloc()
STINNER Victor
report at bugs.python.org
Thu Dec 1 08:25:12 EST 2016
STINNER Victor added the comment:
> I agree with Josh, PyTuple_New() can be faster than PyMem_Malloc() due to tuple free list.
According to benchmarks, PyTuple_New() is slower than PyMem_Malloc(). It's not surprising for me, using a tuple object requires extra work:
* Track and then untrack the object from the garbage collector
* Destructor uses Py_TRASHCAN_SAFE_BEGIN/Py_TRASHCAN_SAFE_END macros
* Some additional indirectons
When I started working on "fastcall", I was surprised that not creating tuples has a *significant* (positive) effect on performance. It seems to be between 5% and 45% faster. Obviously, it depends on the speed of the function body. The speedup is higher for faster functions, like fast functions implemented in C.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28839>
_______________________________________
More information about the Python-bugs-list
mailing list