Shed Skin: Another Way To Compile Python Code

Written by Michael Larabel in Free Software on 4 July 2011 at 10:40 AM EDT. 2 Comments
FREE SOFTWARE
Last week on Phoronix I wrote about Gccpy, which is an effort as part of Google's Summer of Code to develop a Python front-end to GCC that would allow compiling Python into native system binaries using the GNU Compiler Collection. This was of interest to many readers and the developer behind Gccpy, had commented in more detail in the forums. Following that news article I received an email regarding another Python compiler effort.

Mark Dufour wrote in to say that for the last eight years he's been working on a similar effort to compile Python code. Mark developed Shed Skin, which is an experimental Python-to-C++ compiler.

Shed Skin is capable of translating pure statically-typed Python (versions 2.4 through 2.7) code into optimized C++. Shed Skin can generate stand-alone programs or Python extension modules to be used by other Python programs, it's a bit similar to Facebook's HipHop for translating PHP code into highly optimized C++ code. Not only does the Python code need to be statically typed, but it isn't able to take advantage of the Python standard library nor other features like nested functions. Regardless, in tests conducted by the author, Shed Skin was found to be between two and 200 times faster than CPython. Some of the Shed Skin benchmarks are available via GitHub.

Like Gccpy, Shed Skin was also originally sponsored by Google with their GSoC project in their first year.

For those interested in Shed Skin for translating Python code to C++ that can then be compiled, visit the Google Code page. Shed Skin 0.8 was also released last month.
Related News
About The Author
Michael Larabel

Michael Larabel is the principal author of Phoronix.com and founded the site in 2004 with a focus on enriching the Linux hardware experience. Michael has written more than 20,000 articles covering the state of Linux hardware support, Linux performance, graphics drivers, and other topics. Michael is also the lead developer of the Phoronix Test Suite, Phoromatic, and OpenBenchmarking.org automated benchmarking software. He can be followed via Twitter, LinkedIn, or contacted via MichaelLarabel.com.

Popular News This Week