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.

Author benrg
Recipients benrg, mark.dickinson, rhettinger, tim.peters
Date 2022-02-27.08:36:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1645950969.76.0.924703679546.issue46868@roundup.psfhosted.org>
In-reply-to
Content
My example used ints, but I was being deliberately vague when I said "bignums". Balanced-tree reduction certainly isn't optimal for ints, and may not be optimal for anything, but it's pretty good for a lot of things. It's the comparison-based sorting of reduction algorithms.

* When the inputs are of similar sizes, it tends to produce intermediate operands of similar sizes, which helps with Karatsuba multiplication (as you said).

* When the inputs are of different sizes, it limits the "damage" any one of them can do, since they only participate in log2(n) operations each.

* It doesn't look at the values, so it works with third-party types that are unknown to the stdlib.

There's always a fallback case, and balanced reduction is good for that. If there's a faster path for ints that looks at their bit lengths, great.
History
Date User Action Args
2022-02-27 08:36:09benrgsetrecipients: + benrg, tim.peters, rhettinger, mark.dickinson
2022-02-27 08:36:09benrgsetmessageid: <1645950969.76.0.924703679546.issue46868@roundup.psfhosted.org>
2022-02-27 08:36:09benrglinkissue46868 messages
2022-02-27 08:36:09benrgcreate