diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-03-23 18:26:07 +0000 |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-03-23 18:26:07 +0000 |
commit | 2761cd300484e870d15baab1761cd91a3ede9e20 (patch) | |
tree | 9c960ccf937bbfcf480275ace036d78391b5cbdc /Python | |
parent | 4f908ddc884505763c24aba74a447b58385a52ad (diff) | |
download | cpython-git-2761cd300484e870d15baab1761cd91a3ede9e20.tar.gz |
Blocked revisions 70542 via svnmerge
........
r70542 | mark.dickinson | 2009-03-23 18:25:13 +0000 (Mon, 23 Mar 2009) | 14 lines
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.
........
Diffstat (limited to 'Python')
0 files changed, 0 insertions, 0 deletions