summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2004-08-29 22:16:50 (GMT)
committerTim Peters <tim.peters@gmail.com>2004-08-29 22:16:50 (GMT)
commit0973b99e1cfe13b3d197e1b6c449a2d75b55d17a (patch)
tree56d50378b5dd36f12a23149c54554f07bc5784f7 /Misc
parentafb5f9421719e7c7ada1a236bb226c9f84eaf880 (diff)
downloadcpython-0973b99e1cfe13b3d197e1b6c449a2d75b55d17a.zip
cpython-0973b99e1cfe13b3d197e1b6c449a2d75b55d17a.tar.gz
cpython-0973b99e1cfe13b3d197e1b6c449a2d75b55d17a.tar.bz2
SF patch 936813: fast modular exponentiation
This checkin is adapted from part 1 (of 3) of Trevor Perrin's patch set. x_mul() - sped a little by optimizing the C - sped a lot (~2X) if it's doing a square; note that long_pow() squares often k_mul() - more cache-friendly now if it's doing a square KARATSUBA_CUTOFF - boosted; gradeschool mult is quicker now, and it may have been too low for many platforms anyway KARATSUBA_SQUARE_CUTOFF - new - since x_mul is a lot faster at squaring now, the point at which Karatsuba pays for squaring is much higher than for general mult
Diffstat (limited to 'Misc')
-rw-r--r--Misc/ACKS1
-rw-r--r--Misc/NEWS10
2 files changed, 11 insertions, 0 deletions
diff --git a/Misc/ACKS b/Misc/ACKS
index 6eb0f64..dfdf005 100644
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -442,6 +442,7 @@ Steven Pemberton
Eduardo Pérez
Fernando Pérez
Mark Perrego
+Trevor Perrin
Tim Peters
Chris Petrilli
Bjorn Pettersen
diff --git a/Misc/NEWS b/Misc/NEWS
index 4656fa2..431b343 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,16 @@ What's New in Python 2.4 alpha 3?
Core and builtins
-----------------
+- Some speedups for long arithmetic, thanks to Trevor Perrin. Gradeschool
+ multiplication was sped a little by optimizing the C code. Gradeschool
+ squaring was sped by about a factor of 2, by exploiting that about half
+ the digit products are duplicates in a square. Because exponentiation
+ uses squaring often, this also speeds long power. For example, the time
+ to compute 17**1000000 dropped from about 14 seconds to 9 on my box due
+ to this much. The cutoff for Karatsuba multiplication was raised,
+ since gradeschool multiplication got quicker, and the cutoff was
+ aggressively small regardless.
+
- OverflowWarning is no longer generated. PEP 237 scheduled this to
occur in Python 2.3, but since OverflowWarning was disabled by default,
nobody realized it was still being generated. On the chance that user