Pyston returns from the dead to speed Python

Picking up where Dropbox left off, a new development team has released a fresh version of the just-in-time optimizing Python runtime, compatible with Python 3.8

Pyston returns from the dead to speed Python
Shout! Factory

Development of Pyston, a variant of the Python runtime that uses just-in-time compilation to speed up the execution of Python programs, is back on again after a long period of limbo. Picking up where Dropbox left off, a new development team has released Pyston 2.0.

Pyston provides what is ultimately intended to be a drop-in replacement for the standard Python runtime, CPython. It’s compatible with Python 3.8, so programs that runs with that version of Python should run as-is on Pyston.

Pyston performs code generation using just-in-time compilation, or JITting, to yield many of its speedups. Pure-Python programs show the largest improvements, while programs that use C/C++ modules for faster execution, like PyTorch, show less or none.

One of the goals of the project was to remain as close as possible to the original implementation of CPython, since many third-party projects make assumptions about CPython behavior. Thus Pyston 2.0 began with the existing CPython codebase and added features from Pyston 1.0 that worked well, such as caching attributes and JITting. Pyston’s JIT no longer uses LLVM, but DynASM to emit assembly directly.

JITting is the same technique used by another project, PyPy, to deliver major speedups to Python applications — in some cases, seven times what CPython can deliver. However, Pyston’s makers claim their approach has several advantages over PyPy including better compatibility with CPython’s C API and lower memory consumption for common workloads (e.g., Flask and DjangoCMS).

Created at Dropbox, Pyston ceased development in 2017 when the Dropbox withdrew support. Now the project is continuing under the care of some of its original developers, albeit independently.

“In early 2020,” the official Pyston blog states, “enough pieces were in place for us to start a company and work on Pyston full-time.” However, unlike the original Pyston incarnation, the new version is closed-source for the time being, as its new stewards determine their business model. The source code available on the project’s GitHub appears to be from its earlier incarnation, not the most recent version.

Prebuilt binaries of Pyston are available for Ubuntu 18.04 and Ubuntu 20.04 x86_64. The development team is willing to build other editions based on user feedback.

Copyright © 2020 IDG Communications, Inc.