Python Gets Built-In JIT Compiler

The latest alpha release of the Python programming language, Python 3.13.0a6, has introduced an experimental feature that has caught the attention of developers. This release is significant as it serves as the basis for the upcoming stable Python 3.14 release, which is expected in the autumn. The experimental feature in question is the implementation of a Just-In-Time (JIT) compiler that promises a significant increase in productivity.

To enable the JIT feature in CPython, users can utilize the “–enable-experimental-jit” option during assembly. However, it is important to note that the installation of LLVM is necessary as an additional dependency to make use of this feature.

The implementation of the JIT feature in Python 3.13 is based on the “copy-and-patch” architecture. This process involves the use of LLVM to create an object file in the ELF format, which contains bytecode instructions and information for necessary data replacements. The JIT feature replaces the bytecode instructions generated during program interpretation with their machine code equivalents, while substituting the required data for calculations.

Comparisons have shown that the new JIT feature in Python 3.13 offers significant advantages in terms of code generation speed and resulting performance. When pitted against WebAssembly compilation using Liftoff, the new JIT is capable of generating code five times faster, with resulting code that works 50% more efficiently. Furthermore, in comparison to traditional JIT instrumentation, LLVM incorporated into CPython’s JIT provides a 100-fold improvement in code generation speed and a resulting code that is 15% quicker.

/Reports, release notes, official announcements.