Psyco is a Python specializing compiler and is an external module, but it could someday be included in Python itself. With only a tiny amount of extra programming, Psyco can often be used to increase the speed of Python code by orders of magnitude. This article looks at what Psyco is, and tests it in various applications.
hehe.. Man, this thing is way cool! It makes python code FLY!! VERY good stuff. I am happy
I haven’t used it yet but it certainly sounds useful.
this is not a dig on python or those wanting to use it… python is very cool :o)
but i have to wonder why the author talks like learning c is a bad thing…
also i have to woder if jit compiling is the best method…if youre going to all the trouble why not just make a plain old source-to-machine code one?
i do plan on giving this a try tho.. should be fun!
“This speedup is still probably less than the speed of a similar application in C”
— straight out of the article
still, grabbing headlines is nothing new. Certainly got me to read it ๐
A python compiler might be a better performance boost in the longrun, but the author is pretty-right when he (kind of) says that 90% of python scripts run “fast enough”.
python is indeed a very elegant language…
i kind of like running my scripts the JIT way, b/c i find it easyer to debug the code this way.
but once the script is more-or-less complete it’ll be nice to get a speed boost.
JIT compiling can theoretically produce faster code then a plain old source-to-machine code compiler. A JIT can use runtime information to produce on the fly optimizations that are unavailable to a source code compiler.
This is what profile driven compilers try to do, but obviously there is more accurate information available at runtime.
~~~~~
JIT compiling can theoretically produce faster code then a plain old source-to-machine code compiler
~~~~~
any legitimate links to any academic “proofs” to back this claim up with?
any practical benchmark testing?
~~~
A JIT can use runtime information to produce on the fly optimizations that are unavailable to a source code compiler.
This is what profile driven compilers try to do, but obviously there is more accurate information available at runtime.
~~~~
possibly true… but i doubt the benefits will outweigh the limits
I did say theoretically ๐
You’re right that, at least as far as the systems I’ve seen are concerned, the overheads are so high that they are still slower then well crafted C code. Just look at most of the current JVM’s in production. If you want refetrences to verify that my claim is credible, however, start with some of the following.
M. Arnold, S.J. Fink, D. Grove, M. Hind, and P. Sweeney.
Adaptive optimization in the jalapeno JVM.
ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), October 2000.
M. J. Voss and R. Eigemann.
High Level Adaptive Program Optimization With ADAPT.
ACM SIGPLAN Notices, Volume 36, Number 7, Pages 93-102. July 2001.
J. B. Charles.
Dynamic Optimizations in the Mainframe World.
http://www.cesr.ncsu.edu/fddo4/papers/garrett.pdf
V. Bala, E. Duesterwald, and S. Banerjia.
Dynamo: A Transparent Dynamic Optimization System.
ACM SIGPLAN Notices, Volume 35, Number 2, Pages 1-12. February 2000.
Or try
http://www.google.com/search?hl=en&lr=&ie=UTF-8&oe=UTF-8&q=research…
for some links to IBMs research with Jalapeno, which is closely related to this topic.
When I get a bit of free time (yeah, like that happens!) I’ll dig out some moer links, and try to find some on line links.
Oh yeah, stupid me for forgetting:
http://psyco.sourceforge.net/links.html
check out the section marked “Dynamic compiler back-ends”.
๐
It is mentioned in the link list above but deserves an extra mention, HP Dynamo is an interpreter that runs HP PA-RISC 8000 code on a HP PA-RISC 8000 with JIT compilation based on runtime profiles, yielding decent performance _gains_. Quite remarkable technology.
A quick google will reveal a lot of information about Dynamo.
Thanks, Ian will do some reading :o)
> > JIT compiling can theoretically produce faster code then a
> > plain old source-to-machine code compiler
> any legitimate links to any academic “proofs” to back this
> claim up with?
Dynamic compilation can help object-oriented code with lots of polymorphism tremendously, because the compiler knows what classes are likely to appear at method call sites so it can speedup lookup of method addresses maybe a few times or it can even inline the method directly at the call site. Languages using much polymorphism (like SmallTalk) can gain dramatic speedup thanks to this.
JIT compilation does not imply the need to compile the whole application each time before it runs – you can cache the compiled code and then sometimes recompile bits of it to fit to changes in behaviour of the program.
Dynamic compilation just has more information about the program than the traditional static one. It helps languages with lots of uncertainity