Vitja Makarov, 25.11.2010 15:31: > Closure tests helped very much to implement all this stuff.
I bet they did. > I'm not sure (about my PC load) but is seems that whole pyregr test > takes a little bit less time. Here's a little artificial benchmark: def deep_inner(): cdef int x = 1 def f(): def g(): def h(): return x+1 return h return g() return f() ** Python 2.7: Before your patch: $ python -m timeit -s 'from closure_bench import deep_inner as f' 'f()' 1000000 loops, best of 3: 0.313 usec per loop $ python -m timeit -s 'from closure_bench import deep_inner as f' 'f()()' 1000000 loops, best of 3: 0.348 usec per loop After your patch: $ python -m timeit -s 'from closure_bench import deep_inner as f' 'f()' 1000000 loops, best of 3: 0.234 usec per loop $ python -m timeit -s 'from closure_bench import deep_inner as f' 'f()()' 1000000 loops, best of 3: 0.266 usec per loop ** Python 3.2: Before your patch: $ python3 -m timeit -s 'from closure_bench import deep_inner as f' 'f()' 1000000 loops, best of 3: 0.299 usec per loop $ python3 -m timeit -s 'from closure_bench import deep_inner as f' 'f()()' 1000000 loops, best of 3: 0.336 usec per loop After your patch: $ python3 -m timeit -s 'from closure_bench import deep_inner as f' 'f()' 1000000 loops, best of 3: 0.204 usec per loop $ python3 -m timeit -s 'from closure_bench import deep_inner as f' 'f()()' 1000000 loops, best of 3: 0.247 usec per loop That's a lot better, I'd say. Stefan _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev