Guido van Rossum, who created popular programming language Python 30 years ago, has outlined his ambitions to make it twice as fast – addressing a key weakness of Python compared to faster languages like C++.
Speed in the Core Python (CPython) is one of the reasons why other implementations have emerged, such as Pyston.
Its lack of performance partly explains why Python has gravitated towards data science and machine learning, where many workloads are handed off to GPUs. The other reason for its rise in these fields is the wealth of field-specific libraries, from NumPy to the Google-backed TensorFlow machine-learning framework.
SEE: Hiring Kit: Python developer (TechRepublic Premium)
In a contribution to the US PyCon Language Summit this week, van Rossum posted a document on Microsoft-owned GitHub, first spotted by The Register, detailing some of his ambitions to make Python a faster language, promising to double its speed in Python 3.11 — one of three Python branches that will emerge next year in a pre-alpha release.
The Python creator was hired by open-source friendly Microsoft in November, bringing him out of retirement after a stint at Dropbox where he helped it wrangle four million lines of Python code.
He says he “got bored sitting at home while retired” and that he applied for a role at Microsoft. He now serves in the privileged position of a distinguished engineer at Microsoft.
He was “given freedom to pick a project” at Microsoft and adds that he “chose to go back to my roots”.
“This is Microsoft’s way of giving back to Python,” writes van Rossum.
Microsoft has thrown its weight behind Python in various ways, including free Python courses that serve as an on ramp to its Azure cloud AI services, support through its VS Code Python extension, and Python on Windows 10. It’s also been a sponsor of the Python Software Foundation (PSF) since 2006 and gave it $150,000 in sponsorship this year.
According to van Rossum, Microsoft has funded a small Python team to “take charge of performance improvements” in the interpreted language.
Microsoft currently has five core developers who contribute to the development of CPython, including Brett Cannon, Steve Dower, Guido van Rossum, Eric Snow, and Barry Warsaw — all veterans in the Python core developer community.
As Microsoft noted in April, Snow has been working on multi-threaded performance in Python via subinterpreters. Dower serves as build manager and has been a CPython expert for Windows since the 3.5 Python release. Warsaw contributes to the Python Steering Council, Python Security Response Team, and Python Release Managers list.
With recent software supply chain attacks in the spotlight, Microsoft is also focussing on securing the main package repository PyPI (Python Package Index).
“As part of our $150K financial sponsorship of the PSF, we will be focusing our funds to the Packaging Working Group to help with development costs for further improvements to PyPI and the packaging ecosystem,” said Dan Taylor, a principal manager for Microsoft’s Python & AI tools.
“With recently disclosed security vulnerabilities, trusted supply chain is a critical issue for us and the Python community, and we are excited to help contribute to long-term improvements.”
Meanwhile, van Rossum notes he and his Microsoft peers contributions with core Python developers are in the open and are focussed on incremental changes to CPython. Breaking changes are a sensitive issue for Python developers who faced a mammoth task when moving code from Python 2.x to Python 3, which took over a decade to complete.
“No long-lived forks/branches, no surprise 6,000 line [pull requests],” writes van Rossum.
“We’ll take care of maintenance and support too… All discussions in trackers on open GitHub repos,” he added.
He also addressed Python’s interpreter and its C-language application binary interface (ABI) and application protocol interface (API), which has hindered Python innovation in the browser, according to some Python veterans.
“Don’t break stable ABI compatibility; don’t break limited API compatibility; don’t break or slow down extreme cases,” promises van Rossum. “Keep code maintainable,” he adds.
SEE: Programming languages: JavaScript has most developers but Rust is the fastest growing
But will the core Python project actually be able to deliver twice the speed of the current versions of Python? The evidence from van Rossum suggests he doesn’t want to be held to account for such an ambitious project.
“We’re far from certain we will reach 2x!,” he writes. “But optimistic and curious”.
Nonetheless, he teased the idea of a five-fold speed up after Python 3.11, noting that “we’ll have to be creative”.
He says that the main beneficiaries of upcoming changes to Python will be those running “CPU-intensive pure Python code” and users of websites with built-in Python.
There, however, won’t be much benefit for code that’s already written in C, such as NumPy and TensorFlow, I/O-bound code, multi-threading code, and code that’s algorithmically inefficient.