Idle bytecode query on apparently unreachable returns

jepler at unpythonic.net jepler at unpythonic.net
Sun Oct 9 19:37:25 EDT 2005


On Mon, Oct 10, 2005 at 12:20:13AM +0100, Tom Anderson wrote:
> What puzzles me, though, are bytecodes 17, 39 and 42 - surely these aren't 
> reachable? Does the compiler just throw in a default 'return None' 
> epilogue, with routes there from every code path, even when it's not 
> needed? If so, why?
I think the short answer is "yes".  They're unreachable, and they're thrown in
by default.

It's possible that this could be fixed with a slightly smarter compiler, but
the performance difference is likely to be in the noise.  What's one cache miss
(because the bytecode is slightly larger) compared to the total cycles used
in, say, the LOAD_GLOBAL 'fib'?

My bet is that this optimization would not pay off in measurable run-time
gains.

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20051009/2a84cc1f/attachment.sig>


More information about the Python-list mailing list