Paul Krill
Editor at Large

Instagram open sources high-performance Python fork

news
May 6, 20212 mins

By making the Cinder project publicly available, the company wants to open conversation about upstreaming its performance optimizations to standard Python.

racing speed bicycles compete
Credit: Thinkstock

Instagram’s Cinder, a performance-oriented fork of CPython 3.8, is now available as a Facebook Incubator project on GitHub. The goal of releasing the code was to produce a unified, faster CPython, the company 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 optimizations 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-specialized 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 optimizable cases in the execution of generic Python opcodes and dynamically replaces those opcodes with specialized 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 optimization 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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author