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

Alex Gaynor alex.gaynor at gmail.com
Wed Jul 18 03:24:49 CEST 2012

Victor Stinner <victor.stinner <at> gmail.com> writes:

> Example:
> ----
> a = GETLOCAL(0); # "a"
> if (a == NULL) /* error */
> b = GETLOCAL(1); # "b"
> if (b == NULL) /* error */
> return PyNumber_Add(a, b);
> ----
> I don't expect to run a program 10x faster, but I would be happy if I
> can run arbitrary Python code 25% faster.
> --
> Specialization / tracing JIT can be seen as another project, or at
> least added later.
> Victor

This is almost exactly what Unladen Swallow originally did.  First, LLVM will 
do all of the optimizations you are expecting it to do out of the box.  It will
still have all the stack accesses, and it will have all of the ref counting
operations.  You can get a small speed boost from removing the interpretation
dispatch overhead, but you also explode your memory usage, and the speedups are

Please, learn from Unladen Swallow and other's experiences, otherwise they're
for naught, and frankly we (python-dev) waste a lot of time.


More information about the Python-Dev mailing list