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: Minor speedup for bigint squaring
Type: performance Stage: resolved
Components: Interpreter Core Versions: Python 3.11
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: tim.peters Nosy List: tim.peters
Priority: normal Keywords: patch

Created on 2022-01-02 22:48 by tim.peters, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 30345 merged tim.peters, 2022-01-02 22:52
Messages (2)
msg409534 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2022-01-02 22:48
longobject.c's x_mul()'s special code for squaring gets kind of sloppy at the end of a digit pass, doing a useless add of 0 and an "extra" test for carry. Easily cleaned up.

I think the underlying cause is that the HAC algorithm description it was modeled on was quite "hand wavy" about how badly, and exactly when, the carry can exceed a single digit. Things are better-behaved at the end of a digit pass.
msg409645 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2022-01-04 02:41
New changeset 3aa5242b54b0627293d95cfb4a26b2f917f667be by Tim Peters in branch 'main':
bpo-46233: Minor speedup for bigint squaring (GH-30345)
https://github.com/python/cpython/commit/3aa5242b54b0627293d95cfb4a26b2f917f667be
History
Date User Action Args
2022-04-11 14:59:54adminsetgithub: 90391
2022-01-04 02:43:20tim.peterssetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2022-01-04 02:41:28tim.peterssetmessages: + msg409645
2022-01-02 22:52:08tim.peterssetkeywords: + patch
stage: needs patch -> patch review
pull_requests: + pull_request28557
2022-01-02 22:48:26tim.peterscreate