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

Skip to content

[mypyc] Add primitives for bitwise ops - #9529

Merged
JukkaL merged 19 commits into
masterfrom
bitwise-ops
Oct 6, 2020
Merged

[mypyc] Add primitives for bitwise ops#9529
JukkaL merged 19 commits into
masterfrom
bitwise-ops

Conversation

@JukkaL

@JukkaL JukkaL commented Oct 3, 2020

Copy link
Copy Markdown
Collaborator

This adds primitives for &, |, ^, <<, >> and ~. These speed up a
bitwise op microbenchmark by about 10x on Linux.

Long integer operations are only slightly faster, except for certain cases
of mixed short/long integers, where we are significantly faster (but only
maybe 1.5x or so).

Also support bool when relevant, since it's a subclass of int and
overrides some operations.

Work on mypyc/mypyc#751.

@JukkaL
JukkaL requested a review from msullivan October 3, 2020 13:19
@JukkaL

JukkaL commented Oct 3, 2020

Copy link
Copy Markdown
Collaborator Author

Hmm I'm going to have to specialize some of the ops for booleans as well, as otherwise the integer ops will be used, resulting in runtime type errors.

@TH3CHARLie TH3CHARLie left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Overall LGTM and that's a great improvement!

@JukkaL
JukkaL merged commit 6b0f7d7 into master Oct 6, 2020
@JukkaL
JukkaL deleted the bitwise-ops branch October 6, 2020 09:49
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