Saturday, January 16, 2010

We're Finally Excited about Python 3

Every software developer dreams of a chance to go back and revisit some of the "questionable" design decisions in their software, but it's not always practical to do so. When it comes to a widely deployed piece of software, and a programming language no-less, it's even more difficult to go back and change things.

The folks behind Python, however, decided that they would take that risk. Python 3000 (a.k.a Py3K; now, Python 3.1) is a backwards-incompatible revision of our favorite programming language. It was risky, yes, but they were hoping that it would pay off. Sadly though, that hasn't quite been the case.

Almost everyone appreciated the language cleanups in Py3K, but at what cost? Python 3.0 was slow, 3.1 comes with almost no performance benefits over the 2.x branch, and there are far less 3rd party libraries available to use with it. It's the classic Chicken and the Egg problem. Library authors don't want to port over their code until the language offers some significant benefits, and the language won't gain traction until there are more libraries available for it. There is new hope on the horizon though, and a reason for us all to finally really get excited about Python 3. What could possibly tip the balance in favor of Python 3?

Enter "Unladen Swallow"

This interesting little project started just over a year at Google and its aim was to bring real world performance improvements to Python by porting it over to LLVM. There are lots of other resources to read about LLVM, Unladen Swallow, and the proposed improvements, but the most exciting part has been the recent proposal that the next major release of Python 3 will be based on Unladen Swallow. If this is not incentive enough for us all to get excited about Py3K, then I don't know what is. A cleaner, more stream-lined language, and performance improvements of up to an order of mangitude are enough to get any red-blooded developer excited about the future of the platform.

We use a lot of Python at VM Farms (in fact our entire infrastructure is powered by it -- more on this in future posts), so we're certainly excited about the possiblities.

6 comments:

  1. i love python so much but the problem is to find a job that requires python.

    ReplyDelete
  2. I would not recommend getting to much excited about Unladen Swallow. See:
    http://renesd.blogspot.com/2010/01/unladen-swallow-review-still-needs-work.html

    ReplyDelete
  3. I read the article that Stephan Baumeister is pointing to, and while I agree that this is a reason to be skeptical and certainly a reason not to use Unladen Swallow right now, it seems clear to me that Unladen or something like it is the best hope for major performance improvements in Python.

    These sorts of optimizations are difficult - look at how much work Java's Hotspot took! - but tremendously effective in the long-term.

    So don't hold your breath, but don't give up yet...

    ReplyDelete
  4. The Unladen Swallow project itself stresses that its performance improvements are focused on the 2.6+ stream and not the 3.x code base. So far, these improvements have come at the cost of increased memory usage, which isn't exactly a trade off I think we should have to bear.

    I find the enthusiasm for this idea, which seems to be far more based on unfounded hope than any actual evidence of improvements, to be confusing. I'm not really happy with something so untested going into the mainline interpreter and can't help but wonder if the project would be getting as much interest if it didn't have Google's name behind it.

    ReplyDelete
  5. I am sad that the community as a whole hasn't started moving en masse to the 3.1 version. I think the changes are good ones for the benefits going forward.

    ReplyDelete
  6. Surely you are aware of Jesse Noller's recent post? The situation is by no means as gloomy as this blog would make it look.

    ReplyDelete