Saturday, January 27, 2007

Another Raytracer

here's the output of a raytracer in python, called yopyra, by carlos gonzales, after being compiled by shedskin. the speedup is about the same as for the pygmy raytracer, that is part of the unit tests (for this picture it is about 60). I will probably add this program to ss-progs, but I need to remove one hack to support it, and bearophile (who sent me the raytracer) is still adding some nice features, like the ability to read scenes from a file, and render parts of a picture, so it's easy to put those multiple cores to use..

http://mark.dufour.googlepages.com/scene.txt.jpg

Thursday, January 18, 2007

Shed Skin 0.0.18

yes, it's the fourth release of shed skin in about a month. can you tell I'm working on it full-time now? :) here's a list of major changes:

-modifications to work on OSX and 64-bit systems
-improved support for class attributes
-classes can now be used prior to their definition
-several optimizations and fixes for strings
-hash value caching for strings and tuple{int,double,str}
-optional bounds checking using --bounds

thanks to jplevyak, larry, gustavo and denis for helping to get SS to work on 64-bit and OSX systems!

note that it's very hard for CPython to cache hash values for tuples (because the elements might be mutable). once types are known however, e.g., for tuple, SS can cache hash values no problem. this can cause quite a speedup.. for example, the following program is now 10 times faster than under CPython (corresponding to the 10 loop iterations):

sign_words = {}
kawamabahana = 10000000*(1,2)
for x in range(10):
hash(kawamabahana)

I'm going to take a few days off now, and think about a strategy to add iterators (and hence generators and generator expressions), and possibly non-uniform tuples of length greater than 2..

Tuesday, January 16, 2007

24 programs that work

I'm collecting programs that work out-of-the-box with Shedskin CVS, to add to the homepage before releasing 0.0.18 (which should be out within the next few days). So far, I have 24 programs, at a total of about 6,000 lines:

http://mark.dufour.googlepages.com/ss-progs.tgz

Please let me know if you have an interesting program I might add to this set. If someone else would like to perform some testing (analysis time and comparing performance with CPython and Psyco, for example), that would be great.

update: __tim__ pointed me to the nbody debian language shootout test, which becomes about 100 times faster here. I added it to ss-progs.

Thursday, January 11, 2007

Shed Skin 0.0.17

And here goes 0.0.17, with some interesting fixes:

-support for assignment lists, so e.g. '[[a,b],[c,d]] = matrix' and 'for [[a,b],[c,d]] in matrices: ..' work now
-'_' can be used as special assignment target (expression is not assigned), e.g. '[[a,_],_] = matrix' works now
-support for '__name__' attribute of modules, so e.g. "if '__name__' == '__main__'" works now
-various improvements in exception handling (AssertionError, except some_tuple, ..)
-limit on tuple/list unpacking removed, so e.g. a,b,c,d,e,f = some_tuple works now
-improved printing of floats (using "%g" instead of "%f")