Pyston project open sources its faster Python

Pyston 2.2 yields a roughly 30% speed improvement over standard CPython, and the software is now available under an open source license.

Pyston project open sources its faster Python
fabio ballasina (CC0)

Pyston, an alternate version of the Python runtime employing just-in-time compilation and other techniques to speed execution, released a 2.2 version this week with one significant new feature: the full source code, available as an open source project under Python’s original licensing.

The goal of the Pyston project is twofold: Produce a drop-in replacement for the standard Python runtime that can speed up existing Python deployments with no additional effort; and make it possible for innovations in Pyston to be upstreamed back into Python itself, if the core Python team chooses to do so.

Pyston 2.2 is a version of Python 3.8. Pyston runs, by its developers’ own estimates, about 30% faster than stock Python, and in some cases 50% faster.

Pyston began at Dropbox as a more complex and ambitious project that used the LLVM JIT framework to speed Python applications, but that version of the project was suspended when Dropbox decided to withdraw support.

The newer Pyston, courtesy of some members of the Dropbox development team, uses a different approach. It starts with the base CPython code (CPython being the default Python implementation, written in C), and makes changes to CPython that help improve performance without breaking backwards compatibility.

In this sense, Pyston is significantly different from PyPy, the other major alternate Python runtime. PyPy uses just-in-time compilation to achieve significant, sometimes order-of-magnitude performance improvements. But PyPy is a large and complex project that has long struggled with keeping full compatibility with Python, especially with Python extensions written in C. Pyston starts with the CPython codebase and strives to retain compatibility with it.

The original release of Pyston 2 was not open source, as the developers were still figuring out a business model around the software. With the 2.2 release, Pyston’s developers are eyeing the sales of support services as their business model.

Whether any of Pyston’s innovations will find their way back into CPython is not guaranteed. The core Python team has historically avoided adding performance-enhancement measures like just-in-time compilation to CPython, as they’ve long favored simplicity of implementation and maintenance over performance. But enhancements from other Python implementations have been adopted in the past, such as PyPy’s implementation of the dictionary data type that CPython now uses as well.

Copyright © 2021 IDG Communications, Inc.