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] Some tagged integer micro-optimizations #9801

Merged
merged 3 commits into from Jan 7, 2021
Merged

Conversation

JukkaL
Copy link
Collaborator

@JukkaL JukkaL commented Dec 13, 2020

Use PyLong_FromLong instead of PyLong_FromSsize_t since it's faster
(at least on Python 3.8) and happens to work the same on macOS and Linux.
This is an extremely hot operation.

Add some unlikely(...) and likely(...) to tagged integer primitives.

Overall these made the Richards benchmark about 4% faster, which was a
surprisingly big improvement.

(I'm sure there are still some remaining easy performance wins in tagged
integer operations.)

Work on mypyc/mypyc#757.

@JukkaL
Copy link
Collaborator Author

JukkaL commented Dec 13, 2020

Apparently on Windows long is 32 bits. Looks like this doesn't work on Windows, but we can still use it on supported platforms (the generated C isn't intended to be portable across platforms).

@JukkaL JukkaL merged commit 5e20a26 into master Jan 7, 2021
@JukkaL JukkaL deleted the int-boxing-2 branch January 7, 2021 16:28
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.

None yet

2 participants