[Cython] Generators & closure optimization

Vitja Makarov vitja.makarov at gmail.com
Wed Dec 21 19:48:48 CET 2011

Some time ago we were talking about generators optimization by copying
local variables from closure into local scope.

Now I think that should be a good idea to implement this for both
generators and regular closure functions. So local var will be used
for reference and assignment should be made to both copies. Of course
there are some variables that shouldn't be copied: non-local vars,
arrays, C++ classes and structures.
Also it may be a good idea to move outer scope pointer into local variable.

So I'm wondering what is a good test to measure actual speedup?


More information about the cython-devel mailing list