Despite 30 months work, core developer says Python's JIT compiler is often slower than the interpreter
Despite 30 months work, core developer says Python's JIT compiler is often slower than the interpreter

Despite 30 months work, core developer says Python's JIT compiler is often slower than the interpreter • DEVCLASS

python is a language explicitly designed to resist any form of proper optimization. It just can't be made fast
it doubled in speed from 3.9 to now, so it's getting there.
That ignores just how slow it is. It's on the order of 100x slower than "fast" languages like Rust and Go, so doubling in speed... while nice for Python Devs doesn't really make it fast on an absolute scale. They need to double it's speed a few more times at least.
This is a common misconception! It is true that, of the Smalltalk descendants, Python was not designed for speed like Self or Java; but it was not designed to be slow or difficult to compile. The main technique required to implement a Python JIT is virtualizable objects, which allows the JIT to temporarily desynchronize the contents of registers from the contents of the heap; it's not obvious and wasn't in the first few iterations of PyPy. Additionally, it turns out that tracing the meta-level (see docs or the paper) is a key trick: instead of JIT'ing the Python program, the JIT operates on the interpreter, on the Python VM itself!