Python programmers prepare for pumped-up performance

Python developers can look forward to faster implementations with the release of Pyston v2.2, while Facebook is developing its own internal implementation called Cinder from which it aims to upstream improvements to CPython.

As one of the most popular programming languages, Python’s use is particularly prevalent in applications such as data science and machine learning projects. However, it has been criticised for its performance being less than stellar, leading to efforts to inject more fizz into it.

Pyston is one such project, and the just released version 2.2 is claimed to be 30 percent faster than standard Python in the Pyston team’s own web server benchmarks. Pyston is a fork of CPython, and the foundational technology powering Pyston v2.2 is the same as that found in earlier versions, but the project team says it has tuned and optimised more areas and found additional ways to boost performance, particularly in the JIT and attribute cache mechanisms.

One of the ways the team found to squeeze out a bit of extra performance is by removing many of the rarely-used debugging features that Python supports, because they are expensive (i.e. time consuming) when not needed. Doing just this has resulted in a two percent speedup. Developers who want debugging features can apparently still use the “debug build” of stock Python, because of the compatibility between the two.

The Pyston project has had a shaky start, with development hitting a hiatus after Dropbox pulled its sponsorship back in 2017. Now the feedback from potential customers has convinced the project team that Pyston can thrive on an open-source business model, and so the code for Pyston v2.2 is available on GitHub.

Meanwhile, the Facebook Incubator page on GitHub has a new project called Cinder. This is described as Instagram’s internal performance-oriented production version of CPython 3.8, and the ultimate goal is to upstream any changes that boost performance back to CPython.

Thus the Cinder project team warns that while they do run Cinder in production, they are not providing support for anyone running it externally. It is, however, publicly available for anyone to download and try and suggest improvements.

Cinder contains a number of performance optimisations, including bytecode inline caching, eager evaluation of coroutines, a method-at-a-time JIT, and an experimental bytecode compiler that uses type annotations to emit type-specialised bytecode that performs better in the JIT.