That was not the case for the Python community though. The man behind Stackless, Christian Tismer, rewrote the internals of Stackless for version 2.3, which we called Stackless 2.3.1. This would form the platform for Stackless in the later versions of Python, including 2.4 and 2.5. At that point, we had a difficult decision to make because the logistics of maintaining a large software project made it difficult for us to make a large core change in the binaries. Facing questionable benefits and a risky deployment, should we make the jump?
Then several things changed:
- Python moved on. Version 2.4 was released and version 2.5 started in development.
- An increased focus on performance became apparent within the Python community, which culminated in the NeedForSpeed sprint in Reykjavík in the spring of 2006, of which CCP was a co-sponsor.
- Microsoft released Visual Studio 2005, which includes improved optimization, particularly Profile Guided Optimization, and honed it with a service pack earlier this year.
All of this meant that there was now a good reason for us to upgrade to Stackless Python 2.5.
From a programmer's perspective, the changes were not that great. On the C++ level, we needed to make minor adjustments to the low-level API of Python, as well as a revamped API for Stackless. Since we were doing C-level changes, we decided to separate the Stackless runtime out into a DLL and standardize the bindings to it. This also simplifies the process of running the Profile Guided Optimization step during the build process.
The Python programmer sees only minor changes, as all old code continues to work. The biggest change, which did cause some problems, was that Exception objects have been changed to be so-called "new style" instances, and behave slightly different. However, the Python programmer will benefit from some brand new cool features in 2.5 that weren't present in the old version, including:
- A Ternary operator
- Function decorators
- Generators and Generator comprehensions
The associated changes were performed in a separate branch and thoroughly tested. We have seen a considerable performance increase. This increase is primarily due to two things:
- Python itself has been carefully optimized and common operations made faster, and
- Profile Guided Optimization of the Python DLL works really well.
Integration back into the main branch has been performed and counter to the associated risks, all tests indicate that the upgrade will result in a juicy performance boost.