Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
gh-90213: Speed up right shifts of negative integers#30277
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
Uh oh!
There was an error while loading. Please reload this page.
Conversation
mdickinson commented Dec 27, 2021 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
mdickinson commented Dec 27, 2021
One example timing: evaluating -7**100 >> 123 is approximately twice as fast on this branch as on main: |
mdickinson commented Dec 27, 2021
Smaller and larger examples also benefit on my machine: |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mdickinson commented Dec 28, 2021
I've reworked to remove the duplication between the positive and negative branches, and to move the shift==0 check earlier. |
Uh oh!
There was an error while loading. Please reload this page.
Misc/NEWS.d/next/Core and Builtins/2021-12-24-20-21-45.bpo-46055.R0QMVQ.rst Outdated Show resolvedHide resolved
Uh oh!
There was an error while loading. Please reload this page.
bedevere-bot commented Jan 9, 2022
🤖 New build scheduled with the buildbot fleet by @mdickinson for commit b3a1a8f 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
bedevere-bot commented Jan 9, 2022
🤖 New build scheduled with the buildbot fleet by @mdickinson for commit fd4ce81 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
This PR is stale because it has been open for 30 days with no activity. |
markshannon left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure that I understand 100%, but I think it is correct and it does pass the tests.
A few of the variables could have their scope narrowed.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
mdickinson commented Apr 12, 2022
@markshannon Thanks for the review! I've addressed your comments, and I think this should be ready for re-review. |
bedevere-bot commented Apr 12, 2022
🤖 New build scheduled with the buildbot fleet by @mdickinson for commit c5e3f81 🤖 If you want to schedule another build, you need to add the ":hammer: test-with-buildbots" label again. |
markshannon commented May 2, 2022
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