Menu
Instagram open sources high-performance Python fork

Instagram open sources high-performance Python fork

By making the Cinder project publicly available, social media giant wants to open conversation about upstreaming its performance optimisations to standard Python.

Credit: Dreamstime

Instagram’s Cinder, a performance-oriented fork of CPython 3.8, is now available as Facebook Incubator project on GitHub. The goal of releasing the code was to produce a unified, faster CPython, the social media giant said.

Instagram made Cinder publicly available to generate conversation about upstreaming some of the work to CPython, which is the reference implementation of Python, and reducing duplication of work pertaining to CPython performance.

Cinder features performance optimisations including bytecode inline caching, eager evaluation of coroutines, a method-at-a-time JIT compiler, and an experimental bytecode compiler that uses type annotations to emit type-specialised bytecode that runs better in the JIT. However, Cinder is neither polished nor documented for anyone’s use.

Furthermore, Instagram said there is “no capacity” to support Cinder as an open source project, nor any desire for it to become an alternative to CPython.

The developers of Cinder said the goal is to make sure Cinder is sufficiently stable and fast for their production workload but they make no assurances about its stability or correctness or performance for any other workload. They extended an invitation for feedback from anyone who knows how to make Cinder faster.

Cinder’s inline caching implementation observes optimisable cases in the execution of generic Python opcodes and dynamically replaces those opcodes with specialised versions.

For eager coroutine evaluation, if a call to an async function is immediately awaited, the platform executes the called function up to its first await. If the called function reaches a return without needing to await, Cinder will return that value directly without creating a coroutine object or deferring to the event loop. This provides a CPU optimisation in an async-heavy workload.

Cinder is built and tested on Linux x64. Other platforms, such as MacOS, probably will not work, the developers said.


Tags pythonInstagram

Events

Brand Post

Show Comments