Armin Rigo wrote:
I have put on-line some slides from the Python UK conference at ACCU 2004, explaining how Psyco works. It is actually a Pygame application... As far as I can tell, it is the first time someone in the room actually understood something at the end :-)
Hey, *this* is a nice animation, with my beloved Lemmings :-)
I hope it should help to make Psyco a bit less mysterious, and also explain why it is difficult to have a general idea about what kind of speed-up you can expect for specific kinds of code: it is, after all, a pretty low-level "local" process that Psyco does, and it sometimes pays off and sometimes not. It also explains why this process is very much like the usual interpretation that CPython does. If you think about it you might see how useful it would be for Psyco to build on top of an interpreter in a better language than C (i.e. one that can be analysed, not just blindly run).
Yes, this is very clear. For PyPy, it will be interesting to see how efficient Psyco's peephole-like optimization is compared to whole-program analysis. There are probably programs simple enough to be completely optimized through by WPA. On the other hand, the possible optimization paths can grow to very many, giving a huge code bloat. In that case, Psyco's approach is probably more efficient, by creating new code only when it is needed. In the end, I guess both strategies should be combined to get some optimum between analysis time, speed and memory consumption.
Anyway, I can highly recommend to watch this nice movie from Rigo Productions (C) :-))
ciao - chris