Skip to content

GH-113464: Add the JIT to What's New #133486

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
May 6, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Doc/using/configure.rst
Original file line number Diff line number Diff line change
Expand Up @@ -302,14 +302,14 @@ General Options

.. option:: --enable-experimental-jit=[no|yes|yes-off|interpreter]

Indicate how to integrate the :ref:`JIT compiler <whatsnew313-jit-compiler>`.
Indicate how to integrate the :ref:`experimental just-in-time compiler <whatsnew314-jit-compiler>`.

* ``no`` - build the interpreter without the JIT.
* ``yes`` - build the interpreter with the JIT.
* ``yes-off`` - build the interpreter with the JIT but disable it by default.
* ``interpreter`` - build the interpreter without the JIT, but with the tier 2 enabled interpreter.
* ``no``: Don't build the JIT.
* ``yes``: Enable the JIT. To disable it at runtime, set the environment variable :envvar:`PYTHON_JIT=0 <PYTHON_JIT>`.
* ``yes-off``: Build the JIT, but disable it by default. To enable it at runtime, set the environment variable :envvar:`PYTHON_JIT=1 <PYTHON_JIT>`.
* ``interpreter``: Enable the "JIT interpreter" (only useful for those debugging the JIT itself). To disable the JIT at runtime, set the environment variable :envvar:`PYTHON_JIT=0 <PYTHON_JIT>`.

By convention, ``--enable-experimental-jit`` is a shorthand for ``--enable-experimental-jit=yes``.
By convention, ``--enable-experimental-jit`` is shorthand for ``--enable-experimental-jit=yes``. ``--enable-experimental-jit=no`` is the default behavior if the option is not provided. See :file:`Tools/jit/README.md` for more information, including how to install the necessary build-time dependencies.

.. note::

Expand Down
28 changes: 28 additions & 0 deletions Doc/whatsnew/3.14.rst
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Summary -- release highlights
:ref:`argparse <whatsnew314-color-argparse>`,
:ref:`json <whatsnew314-color-json>` and
:ref:`calendar <whatsnew314-color-calendar>` CLIs
* :ref:`An experimental just-in-time compiler <whatsnew314-jit-compiler>`


Incompatible changes
Expand Down Expand Up @@ -715,6 +716,33 @@ in the :envvar:`PYTHONSTARTUP` script.
(Contributed by Łukasz Langa in :gh:`131507`.)


.. _whatsnew314-jit-compiler:

An experimental just-in-time compiler
-------------------------------------

Official macOS and Windows release binaries now include an *experimental* JIT
compiler. Although it is **not** recommended for production use, it can be
enabled by setting the :envvar:`PYTHON_JIT` environment variable. Downstream
source builds can be configured with :option:`--enable-experimental-jit=yes-off`
for similar behavior.

This is still early, foundational work; the performance impact of enabling the
JIT typically ranges from 10% slower to 20% faster, depending on workload. The
most significant missing functionality at this time is the inability for native
debuggers and profilers like ``gdb`` and ``perf`` to unwind through JIT frames
(Python debuggers and profilers, like :mod:`pdb` or :mod:`profile`, work without
modification). Free-threaded builds do not support JIT compilation.

:func:`sys._jit.is_available` can be used to determine if your Python executable
supports JIT compilation. To tell if JIT compilation has been enabled for the
current process, use :func:`sys._jit.is_enabled`.

Please report any bugs or major performance regressions that you encounter!

.. seealso:: :pep:`744`


Other language changes
======================

Expand Down
6 changes: 3 additions & 3 deletions Tools/jit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ choco install llvm --version=19.1.0

## Building

For `PCbuild`-based builds, pass the new `--experimental-jit` option to `build.bat`.
For `PCbuild`-based builds, pass the `--experimental-jit` option to `build.bat`.

For all other builds, pass the new `--enable-experimental-jit` option to `configure`.
For all other builds, pass the `--enable-experimental-jit` option to `configure`.

Otherwise, just configure and build as you normally would. Cross-compiling "just works", since the JIT is built for the host platform.

The JIT can also be enabled or disabled using the `PYTHON_JIT` environment variable, even on builds where it is enabled or disabled by default. More details about configuring CPython with the JIT and optional values for `--enable-experimental-jit` can be found [here](https://docs.python.org/dev/whatsnew/3.13.html#experimental-jit-compiler).
The JIT can also be enabled or disabled using the `PYTHON_JIT` environment variable, even on builds where it is enabled or disabled by default. More details about configuring CPython with the JIT and optional values for `--enable-experimental-jit` can be found [here](https://docs.python.org/dev/using/configure.html#cmdoption-enable-experimental-jit).

[^pep-744]: [PEP 744](https://peps.python.org/pep-0744/)

Expand Down
Loading