[Python-Dev] A new JIT compiler for a faster CPython?

Cesare Di Mauro cesare.di.mauro at gmail.com
Wed Jul 18 07:50:23 CEST 2012

2012/7/18 Victor Stinner <victor.stinner at gmail.com>

> I don't expect to run a program 10x faster, but I would be happy if I
> can run arbitrary Python code 25% faster.

If that's your target, you don't need to resort to a
bytecode-to-binary-equivalent compiler. WPython already gave similar
results with Python 2.6.

The idea behind is that using an hybrid stack-register VM, you'll spend
less time on the ceval loop "constant stuff" (checking for events / GIL
release, etc.). That's because superinstructions aggregates more bytecodes
into a single "wordcode", which requires only one decoding phase, avoids
many pushes/pops, and some unnecessary inc/decr reference counting. A
better peephole optimizer is provided, and some other optimizations as well.

There's also room for more optimizations. I have many ideas to improve both
WPython or just the ceval loop. For example, at the last EuroPython sprint
I was working to a ceval optimization that gave about 10% speed improvement
for the CPython 3.3 beta trunk (on my old MacBook Air, running 32-bit
Windows 8 preview), but still needs to be checked for correctness (I'm
spending much more time running and checking the standard tests than for
its implementation ;-)

In the end, I think that a lot can be done to improve the good old CPython
VM, without resorting to a JIT compiler. Lack of time is the enemy...


> --
> Specialization / tracing JIT can be seen as another project, or at
> least added later.
> Victor
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> http://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe:
> http://mail.python.org/mailman/options/python-dev/cesare.di.mauro%40gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20120718/41d75c78/attachment.html>

More information about the Python-Dev mailing list