[pypy-dev] Static bytecode instruction optimization and pypy (JIT?) optimization

Rocky Bernstein rb at dustyfeet.com
Sun Jul 9 21:10:46 EDT 2017


In looking at Python bytecode over the years, I've noticed that it does
very little to no traditional static-compiler optimization. Specifically:

* Dead code elmination (most of the time)
* Jumps to Jumps or Jumps to the next instruction
* Constant propagation (most of the time)
* Common subexpression elimination
* Tail recursion
* Code hoisting/sinking

Yes, over the years more compiler optimization has been done but it's still
pretty sparse.

The little that I've looked at pypy, it is pretty much the same thing at
the Python bytecode level. That's why a python decompiler for say 2.7 will
work largely unmodified for he corresponding pypy 2.7 version. Same is true
3.2 versus pypy 3.2.

I understand though that pypy can do and probably does some of the
optimization when it JITs. But my question is: if traditional compiler
optimization were done would this hinder, be neutral, or help pypy's
optimization.

Of course, if there were static compiler optimization of the type described
above, that might be a win when JITing doesn't kick in. (And perhaps then
who cares)

But I'm interested in the other situation where both are in play.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20170709/55088929/attachment.html>


More information about the pypy-dev mailing list