[issue36030] add internal API function to create tuple without items array initialization
Sergey Fedoseev
report at bugs.python.org
Wed Feb 27 03:11:53 EST 2019
Sergey Fedoseev <fedoseev.sergey at gmail.com> added the comment:
>> This optimization also can be used for BUILD_TUPLE opcode and in pickle module, if it's OK to add _PyTuple_StealFromArray() function :-)
> I would like to see a micro-benchmark showing that it's faster.
+-----------------+-----------------+-----------------------------+
| Benchmark | build_tuple_ref | build_tuple_untracked |
+=================+=================+=============================+
| (a, ) | 19.9 ns | 19.4 ns: 1.03x faster (-3%) |
+-----------------+-----------------+-----------------------------+
| (a, 1) | 24.0 ns | 22.6 ns: 1.06x faster (-6%) |
+-----------------+-----------------+-----------------------------+
| (a, 1, 1) | 28.2 ns | 25.9 ns: 1.09x faster (-8%) |
+-----------------+-----------------+-----------------------------+
| (a, 1, 1, 1) | 31.0 ns | 29.0 ns: 1.07x faster (-6%) |
+-----------------+-----------------+-----------------------------+
| (a, 1, 1, 1, 1) | 34.7 ns | 32.2 ns: 1.08x faster (-7%) |
+-----------------+-----------------+-----------------------------+
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36030>
_______________________________________
More information about the Python-bugs-list
mailing list