Stackless Python 2.7 | EVE Online

Stackless Python 2.7

2010-08-24 - By CCP porkbelly

From the lookout post of the impregnable CCP stronghold high in the Equus Mortuus mountains, we can see the world turning beneath us. As the universe slowly cools and we turn into ever older geezers, so also do the tools of our trade evolve.

As you may know, EVE has at its core the programming language known as Stackless Python.  When development of EVE was started, all we had to go by was a pocket watch, a piece of twisted wire, Stackless Python 1.5 and an LP with a band called Randver.  Stackless Python, back then, was centered around the concept of "Continuations" and it was rather tricky to use.

Later we moved to Stackless Python 2.0.  Along with the changes to Python itself, Stackless had grown the "Tasklets" and "Channels" that we have come to know and love.

We have since tried to keep abreast of developments in Python.  At various points in time we have upgraded our codebase to use Python 2.1, 2.3 and 2.5 successively.

Due to the amount of work that it entails, both the act of integration and the impact on developers, we have successfully dodged every other version.  But with each new version come benefits:

  • New language features make development simpler and more effective
  • The Python library is improved in terms of features and performance
  • The language itself gains performance improvements.
  • We stay current with a language in development.

Now, after a few years of sticking with Stackless Python 2.5, we have finally taken the leap and upgraded to 2.7.  Python 2.7 was released a few weeks ago, and subsequently, Stackless Python 2.7.

When we do an upgrade like this, it is not a simple task.  There is a lot of private modifications to Python that need to be migrated.  There is a lot of C code that needs recompiling.  And there is a lot of python code that may need some minor modifications.

For this reason, we are very careful to make sure that no unintended problems show up.  We run an extensive set of regression tests to ensure that everything works as before, and a full performance benchmark suite to verify that performance does not degrade.

As an example, we found during testing  that some client entry fields started working differently.  A user would enter a percentage, say 5.55%, and have it rounded to one fractional digit as 5.5% rather than the previous value of 5.6%.  It turned out that the rounding of floating point numbers had been subtly corrected in version 2.7 and that 5.5% is indeed the correct value (because 5.55 is actually stored as 5.54999).  To make such UI sensitive rounding cases work as expected switched to using the decimal module, a toolkit for doing arithmetic in binary coded decimal.

Python 2.7 is the last of a line.  There are no plans to continue with a python 2.8 version.  All Python development is now focused on the 3.2 version of Python.  But we won't be going there any time soon.  Moving from version 2 to 3 is a much bigger leap:  There  are widespread incompatibilities on the API level and there are substantial language changes too. And at this time there appears to be  no immediate benefit to us in switching.

What effect will the upgrade have on the player?  In the short term probably none.  But in the longer term, it will make our job of providing quality services to you simpler, more enjoyable, and easier on our arthritic fingers and receding hairlines.

I've also got us a new stylus for our gramophone.  Stackless Python 2.7 and Randver will keep things moving for quite a while yet.

 - Porkbelly