Skip to content

Commit 26cdf15

Browse files
Add What's New for 3.15 JIT
1 parent 8c87bcd commit 26cdf15

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

Doc/whatsnew/3.15.rst

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ Summary -- Release highlights
6262
.. This section singles out the most important changes in Python 3.15.
6363
Brevity is key.
6464
65+
* The :ref:`JIT compiler <whatsnew315-jit>` has been significantly upgraded,
66+
with 3-4% geometric mean performance improvement on pyperformance benchmarks.
6567

6668
.. PEP-sized items next.
6769
@@ -850,6 +852,94 @@ csv
850852
(Contributed by Maurycy Pawłowski-Wieroński in :gh:`137628`.)
851853

852854

855+
.. _whatsnew315-jit:
856+
857+
Upgraded JIT Compiler
858+
=====================
859+
860+
The JIT compiler introduced in
861+
`Python 3.13 <https://docs.python.org/3.15/whatsnew/3.13.html#an-experimental-just-in-time-jit-compiler>`_
862+
has been significantly upgraded.
863+
864+
Current results from the pyperformance benchmark suite report
865+
`3-4% <https://github.com/facebookexperimental/free-threading-benchmarking/blob/main/results/bm-20251214-3.15.0a2%2B-6cddf04-JIT/bm-20251214-vultr-x86_64-python-6cddf04344a1e8ca9df5-3.15.0a2%2B-6cddf04-vs-base.svg>`_
866+
geometric mean performance over the standard CPython interpreter built with
867+
all optimizations enabled. The speedups range from roughly 20% slowdown to
868+
over 100% speedup (ignoring the unpack_sequence microbenchmark) on the
869+
x86-64 Linux and AArch64 macOS systems. These results are not yet final.
870+
871+
The major upgrades to the JIT are as follows:
872+
873+
* LLVM 21 build-time dependency
874+
* New tracing frontend
875+
* Basic register allocation in the JIT
876+
* More JIT optimizations
877+
* Better machine code generation
878+
879+
...watch this space for more to come before 3.15 beta!
880+
881+
LLVM 21 Build-Time Dependency
882+
-----------------------------
883+
884+
The JIT compiler now uses LLVM 21 for build-time stencil generation. As
885+
always, LLVM is only needed when building CPython with the JIT enabled;
886+
end users running Python do not need LLVM installed. Instructions for
887+
installing LLVM can be found in the
888+
`JIT compiler documentation <Tools/jit/README.md>`_ for all supported
889+
platforms.
890+
891+
(Contributed by Savannah Ostrowski in :gh:`140973`.)
892+
893+
A New Tracing Frontend
894+
----------------------
895+
896+
The JIT compiler now supports significantly more bytecode operations and
897+
control flow than in Python 3.14, enabling speedups on a wider variety of
898+
code. For example, simple Python object creation is now understood by the
899+
3.15 JIT compiler. Overloaded operations and generators are also partially
900+
supported. This was made possible by an overhauled JIT tracing frontend
901+
that records actual execution paths through code, rather than estimating
902+
them as the previous implementation did.
903+
904+
(Contributed by Ken Jin in :gh:`139109`. Support for Windows added by
905+
Mark Shannon :gh:`141703`.)
906+
907+
Basic Register Allocation in the JIT
908+
------------------------------------
909+
910+
A basic form of register allocation has been added to the JIT compiler's
911+
optimizer. This allows the JIT compiler to avoid certain stack operations
912+
altogether and instead operate on registers. This allows the JIT to produce
913+
more efficient traces by avoiding reads and writes to memory.
914+
915+
(Contributed by Mark Shannon in :gh:`135379`.)
916+
917+
More JIT Optimizations
918+
----------------------
919+
920+
More `constant-propagation <https://en.wikipedia.org/wiki/Constant_folding>`_
921+
is now performed. This means when the JIT compiler detects that certain user
922+
code results in constants, the code can be simplified by the JIT.
923+
(Contributed by Ken Jin and Savannah Ostrowski in :gh:`132732`.)
924+
925+
The JIT avoids :term:`reference count`\ s where possible. This generally
926+
reduces the cost of most operations in Python.
927+
(Contributed by Ken Jin, Donghee Na, Nadeshiko Manju, Savannah Ostrowski,
928+
Noam Cohen, Tomas Roun, PuQing in :gh:`134584`.)
929+
930+
Better Machine Code Generation
931+
------------------------------
932+
933+
The JIT compiler's machine code generator now produces better machine code
934+
for x86-64 and AArch64 macOS and Linux targets. In general, users should
935+
experience lower memory usage for generated machine code and more efficient
936+
machine code versus the old JIT.
937+
(Contributed by Brandt Bucher in :gh:`136528` and :gh:`136528`.
938+
Implementation for AArch64 contributed by Mark Shannon in :gh:`139855`.
939+
Additional optimizations for AArch64 contributed by Mark Shannon and
940+
Diego Russo in :gh:`140683` and :gh:`142305`.)
941+
942+
853943
Removed
854944
=======
855945

0 commit comments

Comments
 (0)