Skip to content
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

[mypyc] Inline fast paths of integer unboxing operations #17266

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented May 19, 2024

This applies to int and native integer types.

This speeds up this micro-benchmark by up to 80% (it spends most of the time
unboxing integers):

# a is list[int]/list[i64]/...
for i in a:
    if i == 789:
        n += 1

The impact to compile time when self-compiling is below the noise floor. The generated
binary is about 0.1% larger. Since integer unboxing can be performance-critical,
this seems like a decent win.

Closes mypyc/mypyc#987. Work on mypyc/mypyc#757.

}
}
/* Haven't lost any bits, but casting to long requires extra
* care (see comment above).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe copy the comment referred here for completeness?

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.

Faster native int unboxing
2 participants