Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[mypyc] Some tagged integer micro-optimizations - #9801

Merged
JukkaL merged 3 commits into
masterfrom
int-boxing-2
Jan 7, 2021
Merged

[mypyc] Some tagged integer micro-optimizations#9801
JukkaL merged 3 commits into
masterfrom
int-boxing-2

Conversation

@JukkaL

@JukkaL JukkaL commented Dec 13, 2020

Copy link
Copy Markdown
Collaborator

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

JukkaL commented Dec 13, 2020

Copy link
Copy Markdown
Collaborator Author

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