Sunday, June 19, 2011

Shed Skin 0.8, Programming Language Benchmark

I'm happy to announce the release of Shed Skin 0.8, a (restricted-)Python-to-C++ compiler. It must be one of the best releases so far, with help and feedback from many directions. I'm especially thrilled to see an updated version of the C64 emulator example run one of my all-time favorite games.. :-) The emulator is now well over 3,000 lines (sloccount), and still compiling fine every time. The analysis time is in line with the scalability graph I published earlier. The game goes from a few FPS using CPython to a fluent 50 FPS after compilation on my PC.



The emulator triggered me to finally add support for the 'struct' and 'array' modules to Shed Skin. The struct module is now used to load programs from tape, and the array module is used to maintain a packed version of the screen data.

Another interesting new feature, also triggered by the emulator, allows generated code to print tracebacks for every raised exception (shedskin -x). So it's not entirely the same as in CPython (yet), which only does this for uncaught exceptions, but it's a step in the right direction. Unfortunately, I discovered at the last moment this doesn't work in the windows version. Hopefully this can be fixed for 0.9.

More details about the release can be found in the release notes.

Before I could make this announcement, there was a small performance comparison published, comparing different languages and implementations (such as PyPy, Jython and Shed Skin 0.8) for 4 different benchmarks. Unfortunately, Shed Skin 0.8 fails on one, but the problem is already fixed in GIT (regular expression search on empty string). The performance on the dict test can probably be attributed to the currently still slow I/O in Shed Skin. Improving this will be one of the goals for 0.9. Hopefully by the time you read this the comparison will have been updated at least for the failing test.

update: The file I/O bottleneck was fixed (thanks francois), and the performance comparison has been updated. Note that the first two benchmarks can still run a lot faster when disabling index-out-of-bounds checking (shedskin -b). On my PC, they become 30% and 45% faster, respectively..

update 2: the glitches are now also gone from the C64 example in GIT.

14 comments:

Nederhoed said...

Congratulations. I will buy you a muffin tomorrow! :-)

irmen said...

Nice job. While I'm not using shed skin, I still find it an impressive piece of work.

xyproto said...

Well done. The new version works fine here. I just updated the Arch Linux package.

Unknown said...

Isn't that Way of the Exploding Fist though?

srepmub said...

no, but that one was very nice too, and had great music. but no 2-player mode I think?

srepmub said...

@xyproto: thanks for packaging!! :)

Frafra said...

Thanks for your work :)

Eugeni Dodonov said...

Amazing, thanks a lot for your work! Being a ten-years python fan myself, I can only say - *WOW*!

I included the package into Mandriva repositories, it works great.

srepmub said...

thanks eugeni! :-)

guotie said...

so great!

guotie said...

so great!

Tony said...

Impressive file IO improvements. I did quite usable Mandelbrot generator with library routines shedskinned: http://www.daniweb.com/software-development/python/code/371844

srepmub said...

hi ben,

I think cython is more practical for this, since it works with arbitrary python code, and there's no conversion overhead I think when calling an extension module..

Unknown said...

this is a wonderful sharing..thanks for this post.
serif photoplus x7 product key