Added in CPython 3.13.
To enable tested on Ubuntu 25.04:
git clone https://github.com/python/cpython
cd cpython
git checkout v3.13.7
./configure --enable-experimental-jit
make -j
We can try to test it with python/inc_loop.py:
time ./python python/inc_loop.py 10000000
but the result is just as pathetic as without JIT currently, taking about 1 second for only 10m loops.
This can be compared with the optimal assembly from c/inc_loop_asm.c:
time ./inc_loop_asm.out 1000000000
which does 1 billion loops in about half a second on P14s.
For comparison, PyPy actually speeds things up and does 1 billion loops in about a second, so only 2x worse than native.
TODO triple check that JIT is enabled. Many threads say the command is:
./python -c 'import sysconfig; sysconfig.get_config_var("JIT_DEPS")'
but that fails with:
ModuleNotFoundError: No module named '_sysconfigdata__linux_x86_64-linux-gnu'
For comparison with a properly implemented dynamic language JIT running nodejs/inc_loop.js does 1 billion loops in 0.6s on v22.14.0, close to native.
tonybaloney.github.io/posts/python-gets-a-jit.html documents what the initial "JIT" implementation does. It is just an extremely naive concatenation of instructions that avoids a for + switch. No wonder it doesn't speed things up much at all.

Articles by others on the same topic (1)

CPython by Codex 0 Created 2026-10-14 Updated 2026-11-05
CPython is the principal implementation of Python, developed in the Python project's source repository and distributed through python.org. It parses source code and compiles it into code objects containing bytecode, which its execution machinery evaluates. The dis module makes the bytecode instructions visible, connecting source-level functions with their compiled representation.[ref]
For example, a function that returns len(items) needs to obtain the callable and argument, perform the call and return its result. A bytecode listing reveals those operations, together with version-specific supporting instructions. CPython can specialize instructions as a program runs. Exact instruction names and layouts are implementation details that can change between releases; the meaning of the Python source expression is specified at the language level.