DEV Community

Bas Steins
Bas Steins

Posted on • Originally published at bas.codes

Python might get 5 times faster in the next 4 years

Guido van Rossum, the inventor of Python, works together with Eric Snow and Mark Shannon at Microsoft to make CPython faster.

His overview slides are available on GitHub since last week.

What is CPython

CPython is the de-facto standard for Python. When you download Python from python.org, or using Conda, you most likely use the CPython interpreter.

Since Python programs don't get compiled, we need a Python installation to run our .py files. The python (or, python.exe) executable is called the interpreter. It takes the .py file and translates the source code to something your computer can understand.

Apart from the reference interpreter (CPython), there are several other interpreters, most notably the PyPy interpreter.

The upcoming proposals will affect the CPython interpreter alone, however.

Performance Increase in Python 3.11

In the alpha 6 release of Python 3.11, we have already seen a performance increase of about 19% compared to Python 3.10. Meanwhile, Python 3.11 alpha 7 has been released.

Mark Shannon's plans for a performance increase of 1.5x per year have already been started to take effect in Python 3.11.

The technical details are outlined in PEP 659. The faster-cpython team's goal is to increase the performance without breaking compatibility.

Caveats

Some computationally heavy tasks frequently done in Python include Statistics, Machine Learning, AI, and other scientific computations. Usually, developers use libraries such as numpy, scipy, or tensorflow for that sort of tasks.

Since these libraries are already implemented in the C programming language – meaning that they use the Python interpreter just as a cargo ship for their functionalities – any performance improvement for Python 3.11 and later won't have any significant effect here.

Also, multi-threaded applications might not benefit from these improvements. asyncio, on the other hand, could fill the gap quickly, although this requires a lot of refactoring of legacy code using multi-threading.

Top comments (0)