Python 3.11.2 (2023-02-10)

Introduction

Among 60 fixes, developers maintain a 2 year old, brilliant performance improvement people don’t know about

Python 3.11.2 was released on February 7 and announced on February 9, 2023.

It is a minor release, so why bother? I have spent some time to find some interesting things in this release, and one is a diamond! Let’s dig in!

💎 A Fix Around A Brilliant And Unknown Up To 11% Performance Improvement

What is interesting here is how this improvement was made.

As you probably know, Python dropped long data type after the PEP 237 by Moshe Zadka and Guido van Rossum published in 2001.

Now Python offers only one non-fractional int data type that can hold really long numbers.

Thanks to that change people don’t overflow the variable so often, and it is just easier to code not having to think what data type to use.

Mark Shannon noticed however, that this data type is often used to hold a single digit, like 0, 1, -1 etc.

It makes sense. You usually don’t create empty variables just for the sake of it, but also, one digit variable is the popular choice.

That is why Mark, in absence of the information about the actual variable size introduced a change to allocate always memory for one digit for such variable, no questions asked.

It was two years ago and caused Python to be 1-11% faster in benchmarks. It is just one of many brilliant performance improvements Python offers under the hood.

🩺 Better Help For Input Command

Python offers a built-in help for the standard library functions. For example you can write in your Python script:

WebAssembly Pyodide 0.23.0 release Updating to Python 3.11.2

Pyodide 0.23 uses CPython 3.11.2 which in addition to many feature and enhancements is also the first version to officially support the WebAssembly as a PEP11 Tier 3 platform.

For year Pyodide has been distributing a custom build of CPython with many patches.

Now that we can rely on a mostly unmodified CPython, it has become significantly easier to update CPython versions which is very positive for the project’s sustainability.

We are very grateful for the CPython maintainers ¹ who made this possible.

Python 3.11 is estimated to be between 10-60% faster than Python 3.10 for native execution, and we see comparable improvements with the WebAssembly runtime on our benchmark suite.