Antoine Pitrou wrote:
Thomas Lee <tom <at> vector-seven.com> writes:
By the way, you were right about JUMP_IF_TRUE/JUMP_IF_FALSE. It's far
too late. Apologies.
I'm still pretty sure this is the peepholer's doing,
Yes indeed.
Which is what's being achieved with the AST optimization I originally
proposed, right?
Well, not exactly, your optimization eliminates the UNARY_NOT by swapping the
if/else blocks, while the peepholer eliminates the UNARY_NOT by fusing it with
the subsequent jump opcode. In this case it doesn't make much of a difference,
but if there is only an "if" without an "else", the peepholer's optimization is
still possible while yours is not.
Unless a pass is injected into the if body, which will generate no
additional bytecode and still have the same net effect.
(bottom line: the peepholer is not dead!)
We'll see ;)
Thanks for all your help, I'm looking forward to getting my hands on
that patch.
Cheers,
T
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com