@@ -73,6 +73,7 @@ Summary -- Release highlights
7373 <whatsnew315-utf8-default>`
7474* :pep: `782 `: :ref: `A new PyBytesWriter C API to create a Python bytes object
7575 <whatsnew315-pep782>`
76+ * :ref: `The JIT compiler has been significantly upgraded <whatsnew315-jit >`
7677* :ref: `Improved error messages <whatsnew315-improved-error-messages >`
7778
7879
850851 (Contributed by Maurycy Pawłowski-Wieroński in :gh: `137628 `.)
851852
852853
854+ .. _whatsnew315-jit :
855+
856+ Upgraded JIT compiler
857+ =====================
858+
859+ Results from the `pyperformance <https://github.com/python/pyperformance >`__
860+ benchmark suite report
861+ `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 >`__
862+ geometric mean performance improvement for the JIT over the standard CPython
863+ interpreter built with all optimizations enabled. The speedups for JIT
864+ builds versus no JIT builds range from roughly 20% slowdown to over
865+ 100% speedup (ignoring the ``unpack_sequence `` microbenchmark) on
866+ x86-64 Linux and AArch64 macOS systems.
867+
868+ .. attention ::
869+ These results are not yet final.
870+
871+ The major upgrades to the JIT are:
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+ .. rubric :: LLVM 21 build-time dependency
880+
881+ The JIT compiler now uses LLVM 21 for build-time stencil generation. As
882+ always, LLVM is only needed when building CPython with the JIT enabled;
883+ end users running Python do not need LLVM installed. Instructions for
884+ installing LLVM can be found in the `JIT compiler documentation
885+ <https://github.com/python/cpython/blob/main/Tools/jit/README.md> `__
886+ for all supported platforms.
887+
888+ (Contributed by Savannah Ostrowski in :gh: `140973 `.)
889+
890+ .. rubric :: A new tracing frontend
891+
892+ The JIT compiler now supports significantly more bytecode operations and
893+ control flow than in Python 3.14, enabling speedups on a wider variety of
894+ code. For example, simple Python object creation is now understood by the
895+ 3.15 JIT compiler. Overloaded operations and generators are also partially
896+ supported. This was made possible by an overhauled JIT tracing frontend
897+ that records actual execution paths through code, rather than estimating
898+ them as the previous implementation did.
899+
900+ (Contributed by Ken Jin in :gh: `139109 `. Support for Windows added by
901+ Mark Shannon in :gh: `141703 `.)
902+
903+ .. rubric :: Basic register allocation in the JIT
904+
905+ A basic form of register allocation has been added to the JIT compiler's
906+ optimizer. This allows the JIT compiler to avoid certain stack operations
907+ altogether and instead operate on registers. This allows the JIT to produce
908+ more efficient traces by avoiding reads and writes to memory.
909+
910+ (Contributed by Mark Shannon in :gh: `135379 `.)
911+
912+ .. rubric :: More JIT optimizations
913+
914+ More `constant-propagation <https://en.wikipedia.org/wiki/Constant_folding >`__
915+ is now performed. This means when the JIT compiler detects that certain user
916+ code results in constants, the code can be simplified by the JIT.
917+
918+ (Contributed by Ken Jin and Savannah Ostrowski in :gh: `132732 `.)
919+
920+ The JIT avoids :term: `reference count `\ s where possible. This generally
921+ reduces the cost of most operations in Python.
922+
923+ (Contributed by Ken Jin, Donghee Na, Nadeshiko Manju, Savannah Ostrowski,
924+ Noam Cohen, Tomas Roun, PuQing in :gh: `134584 `.)
925+
926+ .. rubric :: Better machine code generation
927+
928+ The JIT compiler's machine code generator now produces better machine code
929+ for x86-64 and AArch64 macOS and Linux targets. In general, users should
930+ experience lower memory usage for generated machine code and more efficient
931+ machine code versus the old JIT.
932+
933+ (Contributed by Brandt Bucher in :gh: `136528 ` and :gh: `136528 `.
934+ Implementation for AArch64 contributed by Mark Shannon in :gh: `139855 `.
935+ Additional optimizations for AArch64 contributed by Mark Shannon and
936+ Diego Russo in :gh: `140683 ` and :gh: `142305 `.)
937+
938+
853939Removed
854940=======
855941
0 commit comments