New submission from Sergey Fedoseev <fedoseev.ser...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue36031>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to