[Python-Dev] genexps slow? (original) (raw)
Tim Peters tim.one at comcast.net
Mon Apr 5 14:45:51 EDT 2004
- Previous message: [Python-Dev] genexps slow?
- Next message: [Python-Dev] PEP 318: Properties
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
[Tim Peters]
There's a twist there: the functions synthesized for generator expressions get to take the quicker-than-general "fastyield" exit path. Hmm! It looks like tests against WHYYIELD before the fastyield label can no longer succeed, but are still there to slow down non-generator cases.
[Michael Hudson]
Hmm. I think I agree with you. I also think the tests against WHYYIELD in the code for ENDFINALLY are unnecessary,
I meant that one too: all tests against WHY_YIELD physically preceding the fast_yield label appear unnecessary now. The only obvious assignment of WHY_YIELD to "why" appears in YIELD_VALUE now, and that jumps immediately to fast_yield, from which there's no going backwards. do_raise() can't return WHY_YIELD either.
as we (syntactically) don't allow yields when there are finally: statements in play.
Even if we did, a yield doesn't collapse any pending block structure.
If I'm wrong about that, then you're wrong too :-) It's all a bit subtle, to be sure.
Na . I'll toss in some asserts and check it in if nothing blows up.
Once again, I wonder if there was someway we could have two evalframes: one with tracing support, one without. Unfortunately, I don't think this can fly (how do you start tracing?). Maybe we could have a '-notrace' command line flag? But I suspect that this is a silly over-complication.
Me too.
- Previous message: [Python-Dev] genexps slow?
- Next message: [Python-Dev] PEP 318: Properties
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]