[New-bugs-announce] [issue36031] add internal API function to effectively convert just created list to tuple

Sergey Fedoseev report at bugs.python.org
Tue Feb 19 03:35:20 EST 2019


New submission from Sergey Fedoseev <fedoseev.sergey at gmail.com>:

There are several cases in CPython sources when PyList_AsTuple() is used with just created list and immediately after that this list is Py_DECREFed. This operation can be performed more effectively since refcount of items is not changed. For example it gives such speed-up for BUILD_TUPLE_UNPACK:

Before:
$ python -m perf timeit -s "l = [None]*10**6" "(*l,)"
.....................
Mean +- std dev: 8.75 ms +- 0.10 ms

After:
$ python -m perf timeit -s "l = [None]*10**6" "(*l,)"
.....................
Mean +- std dev: 5.41 ms +- 0.07 ms

----------
messages: 335901
nosy: sir-sigurd
priority: normal
severity: normal
status: open
title: add internal API function to effectively convert just created list to tuple
type: performance
versions: Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36031>
_______________________________________


More information about the New-bugs-announce mailing list