Speed-up for loops

Roland Koebler r.koebler at yahoo.de
Thu Sep 2 16:13:39 CEST 2010


Hi,

> Are there any ways to speed up the for/xrange loop?
You can use psyco.

The following example should be about 4-times as fast as your example:

import psyco
psyco.full()
def f():
    imax = 1000000000
    a = 0
    for i in xrange(imax):    
        a += 10     
    print a
f()


regards,
Roland




More information about the Python-list mailing list