[ann] Minimal Python project

John Roth johnroth at ameritech.net
Sat Jan 11 14:52:13 CET 2003


"Edward K. Ream" <edream at tds.net> wrote in message
news:%0TT9.121156$Hs2.11453314 at kent.svc.tds.net...
> > > This announcement seems to be making a truly remarkable claim,
namely
> > > that one could increase the speed of  C code by recoding it in
Python
> > > and then applying Psycho to it.
>
> > Yep, you can!  It takes a pretty strange piece of code, but it does
> happen.
> > For instance, I've written a key-management protocol in Python, and
it
> > really is faster than the C implementations of the same thing when
certain
> > key functions are fed to psyco.  (of course, this may just say that
I have
> > a better feel for algorithm design)
>
> Even with the caveat about the algorithm, such a result is indeed
"truly
> remarkable".  Thanks for this information.
>
> > For instance, in a dynamic language, you can't know until
> > runtime if some argument to a method has constant type or (better)
> > constant value, but a JIT can discover and use this.  If it does
not,
> > and someone passes it a different type or value, the JIT can then
discover
> > this and compile a new version that handles that type, optimised.
> > Note that the constant value case can't be optimised by a C
compiler,
> > unless the function is inlined, which doesn't happen in big programs
very
> > much because the function will often be in another module.
>
> I was referring to something  like this when I wrote point 1.  Still,
it is
> amazing
> that something like this could be so effective.

The actual proof is in Java runtimes. They all seem to use JIT
compilers,
and they wind up being quite effective at speeding up the pig. And of
course this is nothing new, relational data bases would be a curiosity
if they didn't have query optimizers. They'd just be too darned slow
for general use.

John Roth

> I suppose in time all of
> our
> instincts will be revised by psycho.  Still, I'll believe it when I
see it
> :-)
>
> Edward
>
>






More information about the Python-list mailing list