Saturday, September 20, 2008

Shed Skin 0.0.29

I have just released version 0.0.29 of Shed Skin, an experimental (restricted) Python-to-C++ compiler. It's been a while since the last release (well, just under 4 months), because of work and vacation, but mostly because there have been so many changes.

Thanks to the work of Karel Heyse, Pavel Vinogradov, FFAO and David Marek, there is now a pretty much complete implementation of the datetime module. Thanks to a suggestion by Albert Hofkamp, I added support for most of the ConfigParser module (by compiling it with Shed Skin of course), which led me to fix several outstanding but important problems. For example, support for inheritance hierarchies was greatly improved, and mapping keys should now work, too ('%(key)x..' % some_dict).

Since the previous release, I've also gone through the pains of installing FreeBSD, OpenSolaris and 64-bit Ubuntu on a spare PC and testing Shed Skin on each of them, with the result that these platforms are now 'officially' supported. Please see the updated 'installation' section of the tutorial. I also received some GCC 4.3 patches (Seo Sanghyeon and Winterknight), which should work fine now, too. So I guess most platforms should be covered now.

Some other improvements:

-improved support for importing from nested modules such as os.path
-__init__ methods are much less a special-case
-improved support for calling ancestor methods (e.g. Parent.__init__)
-all example programs (ss-progs) now compile as extension modules
-staticmethod and property decorator support (Seo Sanghyeon)
-Shed Skin doesn't crash on highly dynamic/recursive types anymore, making it easier to debug programs to get them to compile
-several fixes in the re module, e.g. re.sub now accepts a replacement function
-tuple hash caching was disabled, as CPython doesn't do this either

For the full changelog, see the release notes wiki at the Googlecode site. Please try out the new release, and let me know about any problems. Note that I probably won't be very responsive for at least a week or so - it has been a somewhat difficult release, and I could use some rest.. :)

14 comments:

Josef Perktold said...

I worked my way through the first two tutorrial examples on WindowsXP, hello world worked instantly.

With the extension simple_module, I had two problems:
The include path for python is hardcoded in ss.py to c:/Python24, while my python is c:/Programs/Python24. This requires changes to the make file or finally I edited ss.py. Making the path configurable would be better in this case.
The second issue, I had, are the run time requirements, running the extension example from the initial command window worked fine. Running it from a different python shell or in IDLE I got a dll load error. I finally copied gc.dll into the working directory, since I don't want yet to put it on the permanent Windows path. After that, the example ran as described. Mentioning the runtime dependencies (on gc.dll, and anything else?) in the tutorial, would be helpful.

Otherwise, this version looks quite good so far (after 1 hour). I tried out previous versions and never got the compilation of a python extension to work.

Josef

srepmub said...

thanks for mentioning these problems.

I forgot about this semi-hardcoded path to c:/PythonX.X, and will have a look at setting the correct path automatically.

the runtime dependencies on gc.dll and libpcre-1.dll are actually mentioned in the tutorial, albeit perhaps not very prominently ^^

thanks again!
mark.

Josef Perktold said...

my mistake, looking again at the tutorial the dependency on the dll's is pretty clear. I was reading too fast.
Josef

Anonymous said...
This comment has been removed by the author.
Unknown said...

Just to give you a Thumbs Up - I used ShedSkin 0.0.29 on Ubuntu to speedup some neural network code and I achieved a huge speedup with 5 hours effort (significantly faster than when using psyco).

I've yet to confirm all the output, once completed I'll post results to my blog and link again here.

I just wanted a chance to say thanks! It was painless, required just the removal of some Raise statements and then It Just Worked with g++.

Ian. (ianozsvald.com)

srepmub said...
This comment has been removed by the author.
srepmub said...

hi ian,

thanks for sharing this. it's nice to hear there are actual out-of-the-box experiences with Shed Skin.. :) typically, I have to fix a few minor things here and there to get something non-trivial to compile.

did Shed Skin give you clear error messages about the unsupported raise statements, or was there some other problem here?

please let me know if I can help debug things, if the output ends up being incorrect.

Unknown said...

@srepmub the error was clear enough, I think it told me that the keyword was unsupported (or something like that), it was a simple matter to comment out those lines.
I'm about to revisit the project (to move the cpps to a different machine for timing tests), once I've confirmed all my code I'll do a blog post and link it here.
Much obliged!
Ian.

Unknown said...

I should add that I hadn't expected anything to work since I'd never read of 'success stories' from others, I just didn't know if shedskin was mature enough.
This is why I'll do the blog post - I want to show others that it is worth trying your project because the speedups are pretty amazing :-)
Ian.

srepmub said...

@ian:
I wouldn't call Shedskin mature, but it certainly improves a lot with every release. I'm almost at a point where I'd like to release a 0.1.

note that the speedup greatly varies with different kinds of speed bottlenecks. if the bottleneck is in the builtins (typically str or set), compilation can actually make things slower; if the bottleneck is in allocating many small objects, C++ typically also won't help a lot; for pure integer/floating-point calculations and inheritance hierarchies the speedup can be huge.

Unknown said...

I definitely feel that the answers presented is relevant to absolutely everyone . Thank you .
locksmith miami

Unknown said...

What a girl, really Stunning, She was truly blessed girl I dream for. - Soumya looked cute in her stockings, suspenders and short skirt, Very receptive to DATY and then really hot sex with CIM to finish. She is top girl who offer me excellent Jaipur escort service.

Anonymous said...

I am Kabir from Punjab, I was in Delhi for spending my vacation, when I was in Delhi I hired Preet Singh, She is completely stunning Delhi Escorts. It's like being in love, fun! All services with a lovely smile. I would really like to keep her for myself. Thanks DEH for helping me.

Unknown said...

I was very happy because I could find this good article
This is one of the best blogs I've found today

Cara Menghilangkan Benjolan Lipoma Di Leher Cara Mengobati Luka Melepuh Cara Menghilangkan Luka Bekas Operasi Pengobatan Alami untuk Mengatasi Batuk Berkepanjangan Cara Menyembuhkan Luka Dinding Lambung Obat Penghilang Gatal yang Sudah Lama & Tidak Kunjung Sembuh Pengobatan Radang Sendi yang Diresepkan oleh Dokter Cara Cepat Mengeringkan Koreng & Menghilangkan Bekasnya Hingga Sembuh Cara Menyembuhkan Nyeri Telapak Kaki Obat Herbal Anyang Anyangan