This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Faster code for trial quotient in x_divrem
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: gregory.p.smith, mark.dickinson, tim.peters
Priority: normal Keywords: patch

Created on 2022-01-24 18:46 by tim.peters, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30856 merged tim.peters, 2022-01-24 18:55
Messages (2)
msg411505 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2022-01-24 18:46
x_divrem1() was recently (bpo-46406) changed to generate faster code for division, essentially nudging optimizing compilers into recognizing that modern processors compute the quotient and remainder with a single machine instruction.

The same can be done for x_divrem(), although it's less valuable there because the HW division generally accounts for a much smaller percent of its total runtime.

Still, it does cut a multiply and subtract out of the loop, and makes the code more obvious (since it brings x_divrem1() and x_divrem() back into synch).
msg411542 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2022-01-25 01:06
New changeset 7c26472d09548905d8c158b26b6a2b12de6cdc32 by Tim Peters in branch 'main':
bpo-46504: faster code for trial quotient in x_divrem() (GH-30856)
https://github.com/python/cpython/commit/7c26472d09548905d8c158b26b6a2b12de6cdc32
History
Date User Action Args
2022-04-11 14:59:55adminsetgithub: 90662
2022-01-25 01:07:14tim.peterssetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-25 01:06:10tim.peterssetmessages: + msg411542
2022-01-24 19:04:02tim.peterssetassignee: tim.peters

nosy: + gregory.p.smith, mark.dickinson
2022-01-24 18:55:00tim.peterssetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request29037
2022-01-24 18:46:38tim.peterssetversions: + Python 3.11
2022-01-24 18:46:28tim.peterscreate