Closed as not planned
Description
Feature or enhancement
Proposal:
In the cpython codebase PyTuple_Pack
is used at various places (https://github.com/search?q=repo%3Apython%2Fcpython+PyTuple_Pack&type=code). The execution is not very fast as the implementation uses va_arg
internally. For the 1- and 2 argument case we can improve performance by providing a direct implementation.
Using PyTuple_Pack2
(example implementation main...eendebakpt:cpython:putuple_pack2) performance of components like pairwise
can be improved. See https://discuss.python.org/t/nwise-itertools/51718/22
- Can we add
Py_TuplePack1
andPy_TuplePack2
to the cpython interface? If so, should it be in the public or private API. - If we add
Py_TuplePack2
should we use it at all places applicable, or only the few performance critical ones? - An alternative for
Py_TuplePack1
that already exists is the internal_PyTuple_FromArray
with second argument1
.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response