Robert Bradshaw, 23.05.2011 20:09:
In any case, I'm -1 to deleting references once their no longer used, we must wait 'till the end of the function, and I'm not sure the savings would be that great either.
Agreed.
In terms of packing/unpacking the variables onto the local C stack, until we have live variable analysis (and even then) it may still be more expensive in some cases than just leaving it there, right?
I agree that it can be substantially more expensive to write back *all* variables on each yield, although it doesn't have to be. It largely depends on the generator code.
However, once we really know which values change between yield calls, i.e. which ones need to be stored away, it will actually be less expensive in most cases. We currently pay the indirection penalty for each access, even read access, whereas the C compiler can then keep important variables in registers and only write them back once per yield.
Stefan _______________________________________________ cython-devel mailing list cython-devel@python.org http://mail.python.org/mailman/listinfo/cython-devel