Unladen Swallow

At Google they are trying to give Python a real boost.  See Ars Technica’s post on the project.

The project is called Unladen Swallow, a reference to Monty Python and the Holy Grail, and the goals are:

We want to make Python faster, but we also want to make it easy for large, well-established applications to switch to Unladen Swallow.

  1. Produce a version of Python at least 5x faster than CPython.
  2. Python application performance should be stable.
  3. Maintain source-level compatibility with CPython applications.
  4. Maintain source-level compatibility with CPython extension modules.
  5. We do not want to maintain a Python implementation forever; we view our work as a branch, not a fork.

The main approach is to use LLVM (an open source virtual machine) and JIT compilation to speed up the code.  This is probably a good idea.  JIT approaches (plus dynamic runtime optimisation) has done wonders for Java and is under the hood of Google’s Chrome browser in the virtual machien V8.

More interesting, though, in my opinion is that they want to support multi-core machines by getting rid of the global interpreter lock (GIL).  Because of global synchronisation issues, multi-threading in Python isn’t quite as parallel as you might think.  It is fine for system calls without blocking, but not really for exploiting multiple cores.  But see Multiprocessing with Python (I wanted to write a separate post on that, but probably won’t have time, so now I’ll just link to it here).

Moore’s law is dead.  Processors are not getting faster, they are just getting more cores. See also Herb Sutter’s The Free Lunch is Over.  Multi-core software is going to be essential for high performance in the future, and by handling this in the VM for Python, rather than running separate processes, we might see runtime parallelisation optimisation.  That would be really exciting!

86-108=-22

Tags: , , ,

3 Responses to “Unladen Swallow”

  1. gioby Says:

    Having google support python is really a good news!!
    This is very interesting, thank you for pointing it out.

    I agree with you with the problem of GIL.

  2. amix Says:

    Hell yeah! This should have been done years ago thought – the current implementation is decades away from Java’s HotSpot or .Net’s CLR.

    I also hope that Google’s V8 team can step in and help :-)

  3. Thomas Mailund Says:

    amir: Sure it “should” have been done years ago, but on the other hand, it hasn’t been quite as necessary for Python. After all, most of the built ins and a lot of the packages are optimised C, so if your code spends a lot of time there, you don’t have to worry about the speed of the actual Python code.

    If you have a lot of algoritmic code in Python, on the other hand, this could help a lot. I have good experiences with the Psyco JIT for that.

    I doubt that Lars and co (the V8 team) will get involved. The Unladen Swallow project will use LLVM, after all, and not their own VM.

Leave a Reply