Saturday, September 10, 2011

Shed Skin 0.9

I have just released version 0.9 of Shed Skin, a restricted-Python to C++ compiler. Looking at the state of things, a 1.0 version is probably not far off. There will probably be several 0.9.x releases first, though.

There were two issues blocking a 1.0 release in my mind, both of which seem to have been fixed with this release.

First, I was not completely happy yet with the type inference scalability. With 0.9, there has been another dramatic improvement in this regard. For example, the C64 emulator is analyzed 10 times faster now (about 3,000 lines in 2 minutes on my PC). But most other example programs are now analyzed much faster. It now seems a realistic option to compile a 10,000 line program.

Second, there were some long standing nasty issues with combining 'incompatible' types (such as for '[[1.0]] == [[1]]', we are comparing different types). Shed Skin 0.9 includes a new framework for dealing with these issues, and the problem seems mostly solved at this point.

There were also some very nice performance optimizations for this release. Francois Boutines greatly optimized file I/O. Complex numbers are now copy-by-value, hence massively faster. And the idiomatic construct 'for .., .. in somedict.iteritems()' should be a lot faster as well now. Thanks to Andreas van Cranenburgh for triggering the latter (as well as some of the type inference improvements) with a nice new example program, a natural language parser.

Shed Skin 0.9 also supports three new modules. Francois Boutines added support for the 'mmap' module. Fahrzin Hemmati added support for 'binascii'. And Tony Veijalainen added support for 'colorsys'.

Further, there has been a massive amount of fixes. Thanks to Jason Ye for triggering several of these. Brent Pedersen fixed some 'set' issues. Francois Boutines fixed a string comparison bug involving \0, and improved 'universal mode' for files. Joris van Zwieten sent in the magic code to only print tracebacks (shedskin -x) for uncaught exceptions.

As usual, more details can be found in the release notes.

In the meantime, Paul Boddie has been at work trying to get Shed Skin 0.9 accepted as an official Debian package. It is already included with Fedora (thanks to Thomas Spura) and some other distributions, but I'm a Debian/Ubuntu user myself, so I would be really pleased to see this happen.

4 comments:

illume said...

wow. this is the most exciting release yet!

The mmap module in particular will allow easy sharing of data with numpy, and pygame programs. This means we do not need to copy big array structures, or convert to lists which will hopefully mean a big speed difference when using shedskin modules inside of CPython.

shedskin for me just moved from really interesting, to highly useful.

srepmub said...

thanks for suggesting such a usage for mmap. I actually hadn't thought of this.. :-) but isn't this a bit of an inconvenient way to share data without copying? it's probably not that hard to find better ways.. such as supporting sharing of array.array, or some kind of general 'memory view' that also works with numpy matrices. I'd be very interested in adding example programs that would benefit from this. perhaps you'd like to discuss this further on the shedskin mailing list?

xyproto said...

shedskin is now an "official" Arch Linux package (in the [community] repo). :)

srepmub said...

awesome, thanks! :-)