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
gh-90213: Speed up right shifts of negative integers #30277
gh-90213: Speed up right shifts of negative integers #30277
Conversation
|
One example timing: evaluating -7**100 >> 123 is approximately twice as fast on this branch as on main: |
|
Smaller and larger examples also benefit on my machine: |
|
I've reworked to remove the duplication between the positive and negative branches, and to move the shift==0 check earlier. |
Misc/NEWS.d/next/Core and Builtins/2021-12-24-20-21-45.bpo-46055.R0QMVQ.rst
Outdated
Show resolved
Hide resolved
|
If you want to schedule another build, you need to add the " |
|
If you want to schedule another build, you need to add the " |
|
This PR is stale because it has been open for 30 days with no activity. |
|
@markshannon Thanks for the review! I've addressed your comments, and I think this should be ready for re-review. |
|
If you want to schedule another build, you need to add the " |
|
AFAICT this looks good, and all the buildbots are happy. |


Taking some ideas from the work of @xuxinhang in #30044, this PR makes right shift of negative integers more efficient, by avoiding the need for temporary intermediate results.
Closes #90213
https://bugs.python.org/issue46055