[issue5512] Streamline integer division

2009-03-24 Thread STINNER Victor
STINNER Victor added the comment: > I already applied the x_divrem patch to the trunk and to py3k Oops! I taught that you applied it to py3k and release30-maint :-/ It's ok, trunk and py3k is enough ;-) -- ___ Python tracker

[issue5512] Streamline integer division

2009-03-24 Thread Mark Dickinson
Mark Dickinson added the comment: Hi Victor! I already applied the x_divrem patch to the trunk and to py3k. Did you mean the release branch? I'd prefer not to backport this to 2.6 or 3.0: it's not a new feature, but it's not a bugfix either and there's always some risk of breakage...

[issue5512] Streamline integer division

2009-03-24 Thread STINNER Victor
STINNER Victor added the comment: Would it be possible to port the patch to python trunk? -- ___ Python tracker ___ ___ Python-bugs-li

[issue5512] Streamline integer division

2009-03-23 Thread Mark Dickinson
Mark Dickinson added the comment: Applied, r70542 and r70547. -- resolution: -> accepted status: open -> closed ___ Python tracker ___ __

[issue5512] Streamline integer division

2009-03-21 Thread Mark Dickinson
Mark Dickinson added the comment: Updated patch. Lots of cleanup, but only one significant change: the inner loop now uses signed arithmetic instead of unsigned arithmetic. This saves a negation and fixes a subtle bug: the previous inner loop code was incorrect when using 15-bit digits on

[issue5512] Streamline integer division

2009-03-18 Thread STINNER Victor
STINNER Victor added the comment: My numbers: # No patch $ ./python /home/haypo/pidigits-2.py 3000 Python 3.1a1+ (py3k:70466, Mar 18 2009, 23:56:06) [GCC 4.3.2] CPU: 64 bits, little endian PyLong: base=2^30, sizeof(digit)=32 bits (...) Best Time; 2300.2 ms # With faster_integer_division.patch

[issue5512] Streamline integer division

2009-03-18 Thread STINNER Victor
STINNER Victor added the comment: Oh, there is no version number of the benchmark tool itself! -- ___ Python tracker ___ ___ Python-bu

[issue5512] Streamline integer division

2009-03-18 Thread STINNER Victor
STINNER Victor added the comment: New version of pidigit: - works on python 2.6, trunk and py3k - display Python version, CPU info (bits, endian), PyLong info (base, digit size) - display usage if no argument is given -- Added file: http://bugs.python.org/file13371/pidigits-2.py __

[issue5512] Streamline integer division

2009-03-18 Thread Mark Dickinson
Mark Dickinson added the comment: Here's the version of pidigits that I was using. -- Added file: http://bugs.python.org/file13370/pidigits_bestof.py ___ Python tracker ___ _

[issue5512] Streamline integer division

2009-03-18 Thread Mark Dickinson
Mark Dickinson added the comment: [Antoine] > Well, the original code in pidigits is by me :-) Apologies for the misattribution! -- ___ Python tracker ___ __

[issue5512] Streamline integer division

2009-03-18 Thread STINNER Victor
STINNER Victor added the comment: Useful informations for an integer benchmark: - CPU type: 32 or 64 bits, endian - Memory size - Python version - Informations about how Python was compiled - Integer implementation: use int_info when it's available, otherwise base=2^15 Who has the last ve

[issue5512] Streamline integer division

2009-03-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: Results here (Athlon X2 3600+ with gcc in 64-bit mode with 30-bit digits), "pidigits_bestof.py 2000": - unpatched: 1644.9 ms - patched: 694.8 ms ! -- ___ Python tracker ___

[issue5512] Streamline integer division

2009-03-18 Thread Antoine Pitrou
Antoine Pitrou added the comment: Well, the original code in pidigits is by me :-) (although it's not stated in the source file). I haven't tried the patch but the performance work you're doing is really impressive, Mark! -- nosy: +pitrou ___ Python

[issue5512] Streamline integer division

2009-03-18 Thread Mark Dickinson
Mark Dickinson added the comment: Sounds good to me! An integer benchmark script in the Tools/ directory would be handy. -- ___ Python tracker ___ __

[issue5512] Streamline integer division

2009-03-18 Thread STINNER Victor
STINNER Victor added the comment: Would it be possible to include integer benchmark tools to upstream? I mean the "pidigit" tool (I didn't wrote this test! I just ported it to Python3) and maybe my "bench_int" tool. It could useful to reproduce the benchmark on different Python versions and d

[issue5512] Streamline integer division

2009-03-18 Thread Mark Dickinson
New submission from Mark Dickinson : Here's a patch that streamlines the x_divrem function in Objects/longobject.c. More benchmarks are needed, but the initial results are promising: for py3k, on a 32-bit machine with 15-bit digits, Victor's pidigits benchmark runs almost twice as fast with