[issue6713] Integer & Long types: Performance improvement of 1.6x to 2x for base 10 conversions
report at bugs.python.org
Tue Sep 8 01:13:03 CEST 2009
STINNER Victor <victor.stinner at haypocalc.com> added the comment:
I wrote a dummy script to generate a big number (2568 decimal digits, 8530
bits) and then benchmark str(n). Results on my computer:
Python 2.7a0, Pentium4 @ 3.0 GHz (32 bits), long base=2^15
Smallest value of 5 runs:
original = 5046.8 ms
patched = 2032.4 ms
For huge numbers, the patch is much (60%) faster.
Small integer (type=int) : n=factorial(10) (22 bits, 7 decimal digits) with
original = 861.7 ms
patched = 639.2 ms
It's also faster (26%).
And with n=1 (1 bit, 1 decimal digit), type=int :
original = 606.7
patched = 561.6
It's a little bit faster (7%) with the patch.
I don't see any performance regression, only good improvements: 60% faster
to huge numbers.
Python tracker <report at bugs.python.org>
More information about the Python-bugs-list