The first beta preview of Python 3.11 has been released, offering a significant speed up of up to 60% faster than Python 3.10 or an average of 25% faster – no code change required.
Python is known as a versatile and popular programming language that is widely considered to be an essential language for data scientists. Indeed, surveys have indicated that Python is the top choice for data professionals, ahead of SQL and R.
Popularity aside, Python is no speed demon. Optimized for easy syntax and ease of coding, Python is far slower than native C code; the latter has been demonstrated to run over a hundred times faster, depending on the task at hand.
Add in multi-threading to take full advantage of modern multi-core processors, and the gap widens even further.
Speeding up Python
This is where Python 3.11 comes in. As reported on ZDNet, Microsoft last year funded a project for the Python Software Foundation (PSF) to make Python twice as fast as the current stable 3.10 series.
Led by Python creator Guido van Rossum and Shannon, work that began at least a year ago is close to fruition and could see a significant increase in Python performance before the end of the year.
It is understood that work on the improved CPython interpreter is almost complete, though “major parts” such as dynamic specialization for loops and binary operations are yet to be completed.
On the plus side, memory consumption in 3.11 remains the same as in 3.10.
Of course, Python can be sped up in various ways, including the use of alternate runtimes to wrap modules written in C/C++, as observed by a report on InfoWorld. These methods do not work with CPython, however, which is the reference implementation of Python which is the most widely used version of the language.
Other projects to speedup Python include:
While the formal release of 3.11 isn’t expected until October 2022, the new version with associated speed-ups is available for download and testing now. It can be downloaded here.
Image credit: iStockphoto/Svetlana Ivanova