Unladen Swallow: Python 3's Best Feature.

by jesse in ,

holy-shit-awesome-2.jpgWe all know (well - unless you've under a rock) about Unladen-Swallow, the semi-Google-Sponsored optimization-focused branch of Python 2.x. Collin, Jeffrey and many others have been working tirelessly on porting the CPython interpreter over to LLVM, applying optimization patches, writing tests, etc all aimed at speeding up real-world operations and code since before last year's PyCon - at that time, the first release was already working hard, rendering YouTube's templates. (See the Project Plan for more information) You probably also saw the 2009Q3 testing/performance results (here), showing a hefty speed increase for various operation. The 2009Q4 will be coming soon.

What you probably don't know - yet, is that a PEP is coming, proposing Unladen Swallow be merged back to Python-core - specifically, the Python 3k branch. Yeah, that's right - a PEP to merge Unladen Swallow back into the mothership, but to Py3k only. Talk about a shot in the arm!

Quoting Collin Winter:

Python 3 is the natural place for something like Unladen Swallow to land: Python 3 is clearly the future, and I think improved performance will be a strong selling point in the language's favor. What we and others have done for Python 2 applies directly to Python 3.


One of the things we've really focused on with Unladen Swallow is creating a solid foundation that the wider CPython developer community can build on top of. We've fixed some nasty problems in the x86-64 JIT, for example, so that the CPython community can focus on the fun stuff -- more optimizations! Having the basic JIT infrastructure in place and well-tested opens up a world of opportunities that didn't exist before.


I think PyPy's focus on research is incredibly valuable. Unladen Swallow has always been about, "what can we achieve right now?" One of our guiding principles has been, Do nothing original, don't be innovative. PyPy is looking 10 years down the road and thinking, What can we do if we question everything? I think having those different perspectives is important to the community. So, no, I don't see us in competition (with PyPy) at all.

There's been a lot of talk about how slow adoption of 3k has been - a backwards incompatible implementation of a widely used language will always have slow(er) adoption then releases of the same language, backwards compatible - but I'd argue that to an extent, part of the reason is that there "haven't been enough carrots" in the Py3k cart to provide enough of an incentive for projects, libraries, etc to move to it at an accelerated rate.

This, well - this changes things. A significantly faster interpreter, a more rational GIL thanks to Antoine Pitrou - these are the improvements to Python 3 which make it the perfect target to aim for for new projects and libraries. It should drastically help provide the impetus for larger libraries to move over. Things like these are exactly why something like the moratorium make sense, efforts can be focused on the ecosystem of python outside of the syntax, on the interpreter, the standard library, etc.

This is huge; and with a little luck, a lot of discussion and debate - and a ton of work, by the end of 2010, we'll have not only the best implementation of Python, as a language to date in Python 3 - but the best interpreter as well.

The PEP should go out for review soon, probably within the next two weeks - and more details/information will be coming out at PyCon in February (you're coming, right?!).

Also see Michael Foord's post about this news too.