-
-
Notifications
You must be signed in to change notification settings - Fork 3k
[mypyc] feat: stararg fastpath when calling fn(*args) with tuple #19623
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
for more information, see https://pre-commit.ci
@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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice win! Constructing objects is slow so this should help (didn't benchmark though).
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. |
… 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.
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.