How Python 3.11 Boosts Speed by Up to 60% – The Secrets Behind Faster CPython
Python 3.11, slated for release in October 2022, delivers a 10‑60% performance boost over 3.10 thanks to the Microsoft‑backed Faster CPython project, which introduces adaptive specialization, memory‑allocator refinements, and several low‑level optimizations that trade a modest memory increase for faster execution.
Python 3.11, expected in October 2022, is one of the most anticipated releases because it promises a significant performance uplift for a language often criticized for its speed.
The Python development team states that “Python 3.11 is 10‑60 % faster than Python 3.10.”
This improvement stems from the Faster CPython project, a Microsoft‑funded effort that includes Python creator Guido van Rossum, senior Microsoft engineer Eric Snow, and project lead Mark Shannon.
At EuroPython in Dublin, the team discussed several speed‑enhancing changes. Mark Shannon highlighted the “adaptive specialized interpreter” described in PEP 659, a technique known as specialization.
Specialization works by monitoring bytecode execution; when a particular instruction runs long enough, the interpreter replaces it with a new, faster instruction tailored to that operation, yielding performance gains of up to 50 % in hot code paths.
Additional optimizations include continuous frame allocation, zero‑cost exception handling, more regular object layout, and lazy creation of object dictionaries.
Core developer Pablo Galindo introduced a new memory analyzer and explained that the performance work also impacts memory usage. The team’s approach reduces calls to the system allocator by using Python’s own memory allocator, allocating larger memory blocks and releasing them in bulk, which slightly increases overall memory consumption.
As one community member noted, Python 3.11 may be the first Python 3 release that is genuinely faster than Python 2.7, offering roughly a 5 % speed advantage after a twelve‑year wait.
Source: https://devclass.com/2022/05/31/how-python-3-11-is-gaining-performance-at-the-cost-of-a-bit-more-memory/
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
