Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Add Py_TuplePack2 and Py_TuplePack1 #118222

Copy link
Copy link
@eendebakpt

Description

@eendebakpt
Issue body actions

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 and Py_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 argument 1.

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

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.