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 sir-sigurd
Recipients sir-sigurd
Date 2019-02-19.08:02:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
PyTuple_New() fills items array with NULLs to make usage of Py_DECREF() safe even when array is not fully filled with real items.
There are multiple cases when this initialization step can be avoided to improve performance. For example it gives such speed-up for PyList_AsTuple():

$ python -m perf timeit -s "l = [None] * 10**6" "tuple(l)"
Mean +- std dev: 4.43 ms +- 0.01 ms

$ python -m perf timeit -s "l = [None] * 10**6" "tuple(l)"
Mean +- std dev: 4.11 ms +- 0.03 ms
Date User Action Args
2019-02-19 08:02:44sir-sigurdsetrecipients: + sir-sigurd
2019-02-19 08:02:44sir-sigurdsetmessageid: <>
2019-02-19 08:02:44sir-sigurdlinkissue36030 messages
2019-02-19 08:02:44sir-sigurdcreate