Long integers, xrange and number theory
Terry Reedy
tjreedy at udel.edu
Mon Dec 9 12:43:38 EST 2002
More information about the Python-list mailing list
Mon Dec 9 12:43:38 EST 2002
- Previous message (by thread): Long integers, xrange and number theory
- Next message (by thread): McMillan Installer - NameError: name 'Analysis' is not defined
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Michael Hudson" <mwh at python.net> wrote in message news:7h3ptsbih9j.fsf at pc150.maths.bris.ac.uk... > "Terry Reedy" <tjreedy at udel.edu> writes: > > Your utility functions (wrapped reduces) would run faster if you > > import operator and use the C-coded functions contained therein > > instead of Python-coded lambdas. > I've said this before, recently, but you will likely go faster with a > for loop. [such as, slightly clipped] > def testf(l): > x = 0 > for y in l: > x += y <snip test results showing 10% speedup on one system, which may or may not hold true on other systems> With a 10% difference, one can usually choose on the basis of esthetic taste (which definitely depends on the person.) However, serious speedup requires shifting from generic PyObject operations to unboxed integer operations via psyco, pyrex, weave, or whatever. For this, I believe the loop version to be much better. When ompiled, it might runs 5 to 10 times faster. Terry J. Reedy
- Previous message (by thread): Long integers, xrange and number theory
- Next message (by thread): McMillan Installer - NameError: name 'Analysis' is not defined
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list