KEMBAR78
[mypyc] Speed up "in" against final fixed-length tuple by JukkaL · Pull Request #19682 · python/mypy · GitHub
Skip to content

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Aug 18, 2025

Previously the in operation here boxed the tuple:

TUP: Final = ('x', 'y')
...
    if s in TUP: ...

Now we don't box the tuple and inline the comparisons against each tuple item instead,
which is more efficient.

Also make the semantics closer to Python and add tests.

@JukkaL JukkaL merged commit 1f9505c into master Aug 18, 2025
13 checks passed
@JukkaL JukkaL deleted the mypyc-improve-in-tuple branch August 18, 2025 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants