Michael Kreim, 03.09.2010 11:21:
So finally I followed the recommendation of Tim Wintle to use cython. I did not know this before, but I figured out the following: additionWintle2.pyx:
>
def addition(): cdef long imax = 1000000000 cdef long a = 0 cdef long i for i in xrange(imax): a = a + 10 print a=> runs (wall clock time): 0:00.04
Note that this isn't the "real" runtime. If you look up the binary code that the C compiler spits out, you'll most likely find the final result for "a" written down as a literal that gets returned from the function. C compilers do these things to benchmarks these days.
Stefan -- http://mail.python.org/mailman/listinfo/python-list
