Message282175
> 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. |
|
Date |
User |
Action |
Args |
2016-12-01 13:25:12 | vstinner | set | recipients:
+ vstinner, serhiy.storchaka, josh.r |
2016-12-01 13:25:12 | vstinner | set | messageid: <1480598712.1.0.951821794739.issue28839@psf.upfronthosting.co.za> |
2016-12-01 13:25:12 | vstinner | link | issue28839 messages |
2016-12-01 13:25:11 | vstinner | create | |
|