[issue2785] alternate fast builtin sum

2012-12-06 Thread Éric Araujo
Changes by Éric Araujo : -- versions: +Python 3.4 -Python 2.6 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: ht

[issue2785] alternate fast builtin sum

2008-05-08 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: The approach of using separate accumulations is intrinsically flawed if you want the same result as a regular sum(). Here's a small dataset that shows why you can't accumulate separate sums by type: >>> d = [1000, - 1000

[issue2785] alternate fast builtin sum

2008-05-08 Thread Jean Brouwers
Jean Brouwers <[EMAIL PROTECTED]> added the comment: The one example given may not be convincing, other ones may be. What is it in the submitted version which is not designed carefully or which may not produce the same results? __ Tracker <[EMAIL PROTECTED]>

[issue2785] alternate fast builtin sum

2008-05-07 Thread Raymond Hettinger
Raymond Hettinger <[EMAIL PROTECTED]> added the comment: Will take a look at this one but am inclined to reject it. The timing benefits are marginal at best and only help in the atypical case of mixed floats and ints. The patch changes the type and ordering of intermediate sums, resulting in

[issue2785] alternate fast builtin sum

2008-05-07 Thread Jean Brouwers
Jean Brouwers <[EMAIL PROTECTED]> added the comment: Here is one, simple comparison between 3 different builtin_sum's, all measured on the same machine, MacOS X 10.4.11 (Intel Duo): 1) Python 2.5.1 ActiveState with standard Slow Summation: % python2.5.1 -mtimeit --setup="x=[1.0e12, 7]*100"

[issue2785] alternate fast builtin sum

2008-05-07 Thread Jean Brouwers
Jean Brouwers <[EMAIL PROTECTED]> added the comment: I did not compare performance (yet). If there is a particular test case, I am happy to measure that. Also, I made sure that the results and errors (!) for non-numeric items are the same as for the original, Slow Summation case. The versio

[issue2785] alternate fast builtin sum

2008-05-07 Thread Antoine Pitrou
Antoine Pitrou <[EMAIL PROTECTED]> added the comment: What is the benefit of this new implementation? If it is faster, can you give us any performance numbers? (for example using timeit) -- nosy: +pitrou __ Tracker <[EMAIL PROTECTED]>

[issue2785] alternate fast builtin sum

2008-05-07 Thread Jean Brouwers
New submission from Jean Brouwers <[EMAIL PROTECTED]>: The attached patch bltmodule2.c.diff is a different implementation of the fast summation code for your consideration. It uses three separate sums to add ints, floats and other objects. All ints are accumulated into a C long, reset even af