Sunday, July 19, 2009

Shed Skin 0.2

I have just released version 0.2 of Shed Skin, an experimental (restricted) Python-to-C++ compiler. It comes with 7 new example programs (for a total of 40 example programs, at over 12,000 lines) and several important improvements/bug fixes. See here for the full changelog.

Other than bug fixes for these programs, this release adds some important optimizations. First and foremost, inlining was greatly improved, resulting in potential speedups across the board. Second, loops such as 'for a, b in enumerate/zip(sequence[, sequence])' should now be dramatically faster (also inside list comprehensions), by avoiding allocation of intermediate tuples. Finally, basic list slicing should now be much faster.

probably, yes. but I have a strong dislike for manual type declarations. I'd much rather get type information from a profiler.. a profiler can give the same and other useful information, without having to change or add anything to the code.

type inference can be made to scale a lot better than shedskin currently does, for statically typed programs at least. I just put together some basic techniques from the literature as my master's thesis.. I'm sure a real TI expert could make it work much, much better. that said, if you dislike manual type declarations as well, then you should agree profiling is the way to go to get type information :)

the python version also throws an IndexError, so this is correct.. :) (you have to provide it with a .jpg file to decode)

shedskin cannot compile itself, because it uses dynamic typing in places (for example, via the visitor pattern). it might be possible to compile just the type inference part, but I don't think it's worth the effort at the moment.