Uh oh!
There was an error while loading. Please reload this page.
gh-90213: Speed up right shifts of negative integers - #30277
Conversation
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.
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.
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