Serdar Yegulalp
Senior Writer
Updated

A new interpreter in Python 3.14 delivers a free speed boost

news analysis
Feb 10, 20253 mins

The new interpreter will run Python programs as much as 5% faster, with no changes to existing code required. A beta of Python 3.14 is due in May.

Green Python 16z9
Credit: Aastels - shutterstock.com

March 10 update: The original version of this article reported the speedup to CPython to be as high as 15% with the new interpreter. The CPython development team has since reported that this number was not accurate, due to a compiler bug in Clang/LLVM 19 โ€œwhich caused the normal interpreter to be slower.โ€ The Whatโ€™s New document for CPython 3.14 has been revised to include this information.

Python 3.14, due out later this year, is set to receive a new type of interpreter that can boost performance by up to 5% with no changes to existing code.

The CPython 3.14 change log describes the feature as โ€œa new type of interpreter based on tail calls.โ€ This description may be a little misleading for those who donโ€™t closely follow internal Python development work. โ€œTail callsโ€ doesnโ€™t mean that CPython, or the Python language, will now support tail call optimization. It refers to an optimization that a C compiler performs on the CPython code, which speeds up the way the interpreter dispatches its bytecode instructions.

No changes to existing Python code are required, and C extension modules for CPython donโ€™t need to be recompiled either, as there are no changes to the CPython APIs or ABIs. Nor does the new interpreter add significant maintenance overhead to CPython, as itโ€™s been implemented mainly by repurposing existing code.

For those who use prebuilt CPython binaries, the new interpreter build should be included as part of the upgrade process to Python 3.14. If you build CPython from source, though, using this feature will require a specific compilation flag for the CPython build process (--with-tail-call-interp).

Most crucially, the new interpreter requires using a C compiler that supports the tail call optimization. Not all C compilers provide such support. However, as of this writing, the compilation process is supported on MSVC and on Clang 19 or better (on x86-64 and AArch64 architectures). It is expected to be added to GCC as well.

Python runs more slowly than machine-compiled languages like Rust or C/C++, in big part because the behaviors of the language make it hard to optimize for speed. But that hasnโ€™t stopped massive efforts to make Python faster without sacrificing backwards compatibility. Most of those efforts focus on optimizing the CPython interpreter to do less workโ€”for instance, by using specialized opcodes and other just-in-time optimizations.

Some of these optimizations yield only marginal, incremental speedups. But many of these speedups work cumulatively. And some of these optimizations, like the tail-call optimization described here, can provide significant performance boosts across the board.

The most common theme in these CPython improvements is how they enhance performance at no cost to the user apart from upgrading the interpreter. Pythonโ€™s broad user base and rich library ecosystem mean that any performance optimizations best serve the Python world when they donโ€™t break backwards compatibility.

The first beta release of Python 3.14, which will allow testing of the new interpreter, is scheduled for May 2025. Interim alpha releases also should include the new interpreter.

Serdar Yegulalp

Serdar Yegulalp is a senior writer at InfoWorld. A veteran technology journalist, Serdar has been writing about computers, operating systems, databases, programming, and other information technology topics for 30 years. Before joining InfoWorld in 2013, Serdar wrote for Windows Magazine, InformationWeek, Byte, and a slew of other publications. At InfoWorld, Serdar has covered software development, devops, containerization, machine learning, and artificial intelligence, winning several B2B journalism awards including a 2024 Neal Award and a 2025 Azbee Award for best instructional content and best how-to article, respectively. He currently focuses on software development tools and technologies and major programming languages including Python, Rust, Go, Zig, and Wasm. Tune into his weekly Dev with Serdar videos for programming tips and techniques and close looks at programming libraries and tools.

More from this author