[Python-Dev] genexps slow? (original) (raw)

Josiah Carlson jcarlson at uci.edu
Wed Mar 31 01:38:35 EST 2004


Also, try a timing with "sum(x for x in xrange(100000))". This will highlight the differences in behavior. With xrange, this genexp will be able to execute entirely in cache.

It'll also overflow on 32 bit processors. It may be better stick with max() or min() to reduce the effect of integer adds. The one drawback is that you /may/ need to use big ranges in order to note significant differences in timings.



More information about the Python-Dev mailing list