It has been 6 years since we last mentioned Shed Skin, a restricted-Python to C++ compiler (Python 2.4-2.6). In the meantime, development has continued at a rapid pace. Shed Skin has taken part in the GSOC and GHOP projects. It is now able to generate extension modules, which can be used in larger Python programs. Its type inference engine has become orders of magnitude faster. One of the Shed Skin example programs, a work-in-progress C64 emulator is now compiled in under a minute on a fast PC. In total there are 64 non-trivial example programs. As may be expected from a static compiler, performance is better than when using PyPy in many cases. Though of course we have to mention that PyPy is much less restricted, and also improving at a rapid pace.
Comparing Shed Skin to pypy is a apples to oranges comparison. However, comparing Shed Skin to rpython (the subset of python pypy is written in) is much more of a apples to apples comparison. In fact the restriction list of Shed Skin is almost exactly the same as the restriction list of rpython.
What you get with rpython however is some very insane optimizations. Where Shed Skin basically does Python to C++ translation, rpython will do deep introspection into the code, unrolling loops, inlining functions, ripping C structures apart (if you only use X out of {X, Y} why allocate space for Y?), and malloc removal. All this means that many times rpython can be faster than hand written C.
Also, the benchmarks shown in the link are from pypy 1.4…pypy 1.7 is the current version. And in one program I’ve see a speed boost of 5x just going from pypy 1.6 -> 1.7.
—-
And on top of all that, just because it’s using a static compiler does not magically make it faster. There are several benchmarks where pypy actually out performs C code.
Edited 2012-01-16 14:28 UTC
I’d like to see a comparison to Cython.
I am currently using Cython to create bindings for a 3rd party library and I’m loving it.