Robert Bradshaw, 20.11.2009 19:58: > How much of a performance lost are we talking here? If we're already > unpacking python arguments,
Most of this will happen behind METH_O functions or __next__, so I'd expect most generator code to run without tuple (un-)packing. Couroutines and their .send(x) method will require a tuple, though, at least when called from user code. > passing through virtual functions, Yes. Even __next__ will be called through the type slot. > and returning object, having a list of gotos in a switch statement will > probably not even be measurably slower (though worth checking). I agree that the existing overhead is heavy enough to allow for an additional switch statement. We might also be able to generate both using a precompiler switch. The closure class could have a union {void* label, size_t yield_id} yield_target and the generated entry code could use either of them depending on the C compiler being used. > That > would seem sufficient for a first pass, at least until we have cdef- > level calling of generators. Although that shouldn't be too far off once we have working generators. Stefan _______________________________________________ Cython-dev mailing list Cython-dev@codespeak.net http://codespeak.net/mailman/listinfo/cython-dev