Tim Peters <t...@python.org> added the comment:

> Using jumps is not removing the optimization
> entirely, is just a weaker and more incomplete
> way of doing the same. 

Sorry, I'm afraid I have no idea what that means.  The generated code before 
and after was wildly different, as shown in Ned's original report here.  In 
what possible sense was his "if 0:" being "optimized" if it generated code to 
load 0 onto the stack, then POP_JUMP_IF_FALSE, and then jumped over all the 
code generated for the dead block?

The generated code after is nearly identical if I replace his "if 0:" with "if 
x:" (which the compiler takes to mean a global or builtin about whose 
truthiness it knows nothing at all).  Indeed, the only difference in the byte 
code is that instead of doing a LOAD_CONST to load 0, it does a LOAD_GLOBAL to 
load x.

So, to my eyes, absolutely nothing of the optimization remained.  At least not 
in the example Ned posted here.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue37500>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to