How we are making Python 3.11 faster
2022-07-14 , The Auditorium

Python 3.11 is between 10% and 60% faster than Python 3.10, depending on the application.
We have achieved this in a fully portable way by making the interpreter adapt to the
program being run, and by streamlining key data structures.

In this talk I will explain what changes we have made, and how they improve performance.


The "Faster CPython" project aims to speed up Python, specifically CPython, by a large factor over the next few releases.
The first release to see the benefits of this work is Python 3.11.

Python 3.11 includes the following major changes:

  • Adaptive specializing interpreter (PEP 659)
  • Consecutively allocated execution frames
  • Zero cost try-except
  • More regular object layout
  • Lazily created object dictionaries.

I will describe each of these, describing how each helps speed up Python, and how they interact with each other.

I will end the talk with some possible directions for Python 3.12.


Expected audience expertise: Domain:

none

Abstract as a tweet:

Python 3.11 is faster than 3.10. Find out how we have achieved this.

Expected audience expertise: Python:

some

I've been using Python since 2005.
I have an extensive background in compilers, virtual machines and static analysis for dynamic languages, specifically Python.
After a long interlude working on static analysis tools, I have returned to performance work over the last couple of years.

I am currently working as technical lead with the "Faster CPython" team funded by Microsoft.

This speaker also appears in: