diff options
author | Tim Peters <tim.peters@gmail.com> | 2002-08-12 17:36:03 (GMT) |
---|---|---|
committer | Tim Peters <tim.peters@gmail.com> | 2002-08-12 17:36:03 (GMT) |
commit | d64c1def7ca69e346bade11f2a99651eb8e2ff35 (patch) | |
tree | 6c2f540c804be7f24f9c3ae0daca6368aeab4ab8 /Misc | |
parent | a6fa0e6f2e0e2df20b008f3e5c5b0be25a0516de (diff) | |
download | cpython-d64c1def7ca69e346bade11f2a99651eb8e2ff35.zip cpython-d64c1def7ca69e346bade11f2a99651eb8e2ff35.tar.gz cpython-d64c1def7ca69e346bade11f2a99651eb8e2ff35.tar.bz2 |
k_mul() and long_mul(): I'm confident that the Karatsuba algorithm is
correct now, so added some final comments, did some cleanup, and enabled
it for all long-int multiplies. The KARAT envar no longer matters,
although I left some #if 0'ed code in there for my own use (temporary).
k_mul() is still much slower than x_mul() if the inputs have very
differenent sizes, and that still needs to be addressed.
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -57,9 +57,16 @@ Type/class unification and new-style classes Core and builtins -- XXX Karatsuba multiplication. This is currently used if and only - if envar KARAT exists. It needs more correctness and speed testing, - the latter especially with unbalanced bit lengths. +- When multiplying very large integers, a version of the so-called + Karatsuba algorithm is now used. This is most effective if the + inputs have roughly the same size. If they both have about N digits, + Karatsuba multiplication has O(N**1.58) runtime (the exponent is + log_base_2(3)) instead of the previous O(N**2). Measured results may + be better or worse than that, depending on platform quirks. Note that + this is a simple implementation, and there's no intent here to compete + with, e.g., gmp. It simply gives a very nice speedup when it applies. + XXX Karatsuba multiplication can be slower when the inputs have very + XXX different sizes. - u'%c' will now raise a ValueError in case the argument is an integer outside the valid range of Unicode code point ordinals. |