The Pyston project, which offers an alternative Python runtime using just-in-time (JIT) compilation and various optimization techniques, has released its 2.2 version this week. One of the most exciting changes in this release is that the entire source code is now available as an open-source project, licensed under Python’s original terms. This move makes Pyston’s faster Python implementation more accessible to developers looking to improve performance without abandoning the Python ecosystem.
The primary objectives of Pyston are twofold: first, to create a drop-in replacement for the standard Python runtime that speeds up existing Python applications without requiring significant changes; and second, to allow any advancements in Pyston to potentially be contributed back to the core Python language, should the Python team decide to integrate them. This ensures that innovations made in Pyston could benefit the broader Python community in the future.
Pyston 2.2 is based on Python 3.8 and, according to its developers, runs approximately 30% faster than the standard Python runtime, with some workloads seeing performance improvements of up to 50%. These speed gains are achieved through several optimizations, with the most notable being the application of JIT compilation techniques and adjustments to the CPython codebase.
Originally conceived at Dropbox, the Pyston project began as a more ambitious endeavor using the LLVM JIT framework to accelerate Python execution. However, after Dropbox decided to discontinue support, the project was restructured. The new iteration of Pyston, developed by some of the original team members, builds on CPython—the default Python implementation written in C. By modifying CPython’s code to enhance performance while maintaining backward compatibility, Pyston avoids the compatibility issues that often arise with other Python runtimes like PyPy.
Unlike PyPy, which also uses JIT compilation to achieve faster execution but faces challenges maintaining full compatibility with Python extensions written in C, Pyston’s approach allows for greater compatibility with existing Python projects. This makes Pyston an attractive option for developers looking for performance improvements without sacrificing the stability or compatibility of their Python code.