[Python-Dev] lnotab and the AST optimizer
Antoine Pitrou
solipsis at pitrou.net
Thu Jul 24 18:15:57 CEST 2008
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.
(bottom line: the peepholer is not dead!)
cheers,
Antoine.
More information about the Python-Dev
mailing list