[Python-Dev] Suggest reverting today's checkin (recursive constant folding in the peephole optimizer)

Mark Dickinson dickinsm at gmail.com
Sat Mar 12 11:07:22 CET 2011


FWIW, I'm -1 on backing out Antoine's patch.  In addition to fixing
the minor optimization regression, it makes the peepholer
significantly more consistent in what it can and can't fold.  One of
the first times that I delved into the peepholer code was to try to
understand why expressions like:  2 * 3 * 4 and 3**2 * 7 were constant
folded, when 2 * (3 * 4) and 7 * 3**2 were not;  with Antoine's patch,
they're all folded.  That both Antoine and Eugene are happy with the
code gives me confidence in its correctness.

I can also see the case for ripping out the peepholer entirely.  But
reverting Antoine's patch seems like a step backwards.

Mark


More information about the Python-Dev mailing list