Issue #5512: speed up the long division algorithm for Python longs.
commit2a30fc4abd146cf272be07b0cdf917e7fa4b9532
authormark.dickinson <mark.dickinson@6015fed2-1504-0410-9fe1-9d1591cc4771>
Mon, 23 Mar 2009 18:25:13 +0000 (23 18:25 +0000)
committermark.dickinson <mark.dickinson@6015fed2-1504-0410-9fe1-9d1591cc4771>
Mon, 23 Mar 2009 18:25:13 +0000 (23 18:25 +0000)
treefce57d5858816be6fe257f7e934b69b998c1c008
parentb16f7c83112971832eec2114890597fb2929df12
Issue #5512: speed up the long division algorithm for Python longs.
The basic algorithm remains the same; the most significant speedups
come from the following three changes:

  (1) normalize by shifting instead of multiplying and dividing
  (2) the old algorithm usually did an unnecessary extra iteration of
      the outer loop; remove this.  As a special case, this means that
      long divisions with a single-digit result run twice as fast as
      before.
  (3) make inner loop much tighter.

Various benchmarks show speedups of between 50% and 150% for long
integer divisions and modulo operations.

git-svn-id: http://svn.python.org/projects/python/trunk@70542 6015fed2-1504-0410-9fe1-9d1591cc4771
Misc/NEWS
Objects/longobject.c