STINNER Victor <victor.stin...@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 100000 loops. 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. ---------- nosy: +haypo _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6713> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com