"Tim Peters" <tim.one at comcast.net> writes: > Resuming a generator function is a lot cheaper than calling a > function, but there's still a non-trivial amount of code to get in > and out of eval_frame() each time, which the listcomp version gets > to skip. This is something that occurred to me a while ago: how many opcodes does a typical invocation of eval_frame actually execute? A little script told me that the median length of functions in Lib/*.py was 38 instructions (or 52 bytes) IIRC, but obviously a dynamic count is far more interesting. If the number is fairly small (and honestly, I have no idea), the set up and tear down code becomes much more significant than one might think. I didn't think much about the code to get *out* of eval_frame. Cheers, mwh -- I love the way Microsoft follows standards. In much the same manner that fish follow migrating caribou. -- Paul Tomblin -- http://home.xnet.com/~raven/Sysadmin/ASR.Quotes.html
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4