KEMBAR78
[mypyc] Some tagged integer micro-optimizations by JukkaL · Pull Request #9801 · python/mypy · GitHub
Skip to content

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 JukkaL requested a review from msullivan December 13, 2020 18:49
@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.

2 participants