New Python 3.13 — Improved Performance and Multithreading

New Python 3.13 — Improved Performance and Multithreading

10.10.2024
Author: HostZealot Team
2 min.
112

On October 7, 2024, the stable version of Python 3.13 was released, bringing many significant innovations, including an experimental JIT compiler, a mode without the Global Interpreter Lock (GIL), and an updated interactive interpreter based on PyPy. These improvements aim to enhance the performance and usability of the language. Python 3.13 will be supported for a year and a half, followed by security updates for an additional three and a half years.


One of the key new features is the experimental JIT compiler, which significantly accelerates program execution. To enable JIT in CPython, a build option --enable-experimental-jit has been added, requiring the installation of LLVM. This compiler operates on the Copy-and-Patch architecture, replacing bytecode with machine instructions in real time.


Another addition is the ability to build CPython without GIL. This feature, activated by the --without-gil option, enables parallel code execution on multi-core systems, addressing lock issues in multithreaded environments. However, disabling GIL slightly decreases performance for single-threaded programs, offset by gains in multithreading.


Another important improvement is the updated interactive interpreter, borrowing features from PyPy. It now supports multi-line editing, colored tracebacks, interactive help, and other enhancements for more convenient coding.


Python 3.13 also includes improved handling of local variables in functions and introduces a new typing.TypeIs annotation, and implements other notable changes, including an enhanced version of the mimalloc memory allocation library.

This release marks a significant step forward in Python's development, boosting its performance and opening new possibilities for multithreading and interactive programming.

Related Articles