This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients josh.r, serhiy.storchaka, vstinner
Date 2016-12-01.13:25:11
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480598712.1.0.951821794739.issue28839@psf.upfronthosting.co.za>
In-reply-to
Content
> 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.
History
Date User Action Args
2016-12-01 13:25:12vstinnersetrecipients: + vstinner, serhiy.storchaka, josh.r
2016-12-01 13:25:12vstinnersetmessageid: <1480598712.1.0.951821794739.issue28839@psf.upfronthosting.co.za>
2016-12-01 13:25:12vstinnerlinkissue28839 messages
2016-12-01 13:25:11vstinnercreate