[mypyc] feat: stararg fastpath when calling fn(*args) with tuple#19623
Merged
JukkaL merged 8 commits intopython:masterfrom Aug 13, 2025
Merged
[mypyc] feat: stararg fastpath when calling fn(*args) with tuple#19623JukkaL merged 8 commits intopython:masterfrom
JukkaL merged 8 commits intopython:masterfrom
Conversation
for more information, see https://pre-commit.ci
Contributor
Author
|
@JukkaL @ilevkivskyi I notice other people are somehow Requesting Review for other PRs via the Github UI. I couldn't figure out how to do that but this PR is nice and short, and ready for review. |
JukkaL
approved these changes
Aug 13, 2025
Collaborator
JukkaL
left a comment
There was a problem hiding this comment.
Nice win! Constructing objects is slow so this should help (didn't benchmark though).
Contributor
Author
|
Yeah I also didn't think to do any benchmarking here since the IR shows such a clear improvement. Thanks for merging, I'll rebase those other 3 related PRs for you sometime today. |
JukkaL
pushed a commit
that referenced
this pull request
Aug 18, 2025
… generic sequences (#19629) This PR extends #19623 with additional logic for handling non-tuple star inputs Now, we can use the fast path for any arbitrary sequence, in addition to tuples. I opted to separate this PR from 19623 to keep them smaller and easier to review, and to declutter the changes in the IR.
JukkaL
pushed a commit
that referenced
this pull request
Aug 26, 2025
This PR adds a new custom_op for PyObject_CallObject which is more efficient than PyObject_Call in cases where there are no kwargs. posarg-only use cases are already optimized but this is helpful for patterns such as `fn(*args)` or `fn(a1, a2, *args)` This PR extends #19623 and #19629 , as this change will not be helpful until those PRs are merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are 3 safe cases where we can reuse a tuple when calling a python function:
fn(*args)
fn(*args, **kwargs)
fn(*args, k=1, k2=2, **kwargs)
This PR covers the first two cases.
The IR diff will probably demonstrate this change better than I can explain it.