This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author mark.dickinson
Recipients MrJean1, mark.dickinson, rhettinger, tim.peters
Date 2008-07-31.14:27:57
SpamBayes Score 0.000123603
Marked as misclassified No
Message-id <1217514482.57.0.921732228816.issue2819@psf.upfronthosting.co.za>
In-reply-to
Content
[Tim]
> if you're concerned about speed, it would probably pay to eliminate all
> library calls except one to frexp().

Indeed it would!  Here's a revised patch that avoids use of fmod.  Speed is comparable with the current 
version.  Here are some timings for summing random values on OS X/Core 2 Duo, on a non-debug build of the 
trunk. lsum is the patched version, msum is the version in the current trunk; timings are in seconds.

                                                |  lsum    |  msum
------------------------------------------------+----------+---------
50000 random values in [0, 1)                   | 0.003091 | 0.002540
50000 random values in [0, 1), sorted           | 0.003202 | 0.003043
50000 random values in [0, 1), reverse order    | 0.003201 | 0.002587
50000 random values in [-1, 1)                  | 0.003229 | 0.002829
50000 random values in [-1, 1), sorted          | 0.003183 | 0.002629
50000 random values in [-1, 1), reverse order   | 0.003195 | 0.002731
50000 random exponential values                 | 0.003994 | 0.006178
50000 random exponential values, sorted         | 0.003713 | 0.007933
50000 random exponential values, reverse order  | 0.003714 | 0.002849

Note that lsum doesn't suffer from the 'fragmentation of partials' problem that slows down msum for sorted 
datasets.

I'll do some timings on Linux/x86 as well.
History
Date User Action Args
2008-07-31 14:28:03mark.dickinsonsetrecipients: + mark.dickinson, tim.peters, rhettinger, MrJean1
2008-07-31 14:28:02mark.dickinsonsetmessageid: <1217514482.57.0.921732228816.issue2819@psf.upfronthosting.co.za>
2008-07-31 14:28:01mark.dickinsonlinkissue2819 messages
2008-07-31 14:28:00mark.dickinsoncreate