EuroPython 2016

Fast Async Code with Cython and AsyncIO

Speaker(s) Stefan Behnel

Python has recently seen a fresh development boost around asynchronous applications, triggered by the addition of the asyncio library and the new async/await language features in Python 3.5, but coming from a world of well established tools like Twisted and Tornado. The Cython compiler, which compiles Python code to C, has accompanied and influenced this development. It provides full language support for async/await under all Python versions starting from 2.6, as well as native interoperability with existing Python code and the new Python coroutines in Python 3.5.

Benchmarks show that, while fully compatible, Cython compiled coroutines perform about 2-3x better than the same code executed in Python, but they additionally allow to interface natively with external C/C++ code, release the GIL, do parallel computation, and much more. All of this extends the applicable zone for asynchronous applications dramatically and can lead to better responsiveness and lower latency also for mostly I/O bound applications.

This joined talk by an async I/O expert and one of the Cython core developers explains how to write code with async/await in Python and Cython, and shows how to benefit from the excellent low-level features that Cython provides on top of Python.

in on Monday 18 July at 11:15 See schedule

Do you have some questions on this talk?

New comment