[ann] Minimal Python project
Edward K. Ream
edream at tds.net
Sat Jan 11 06:15:07 EST 2003
> > 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. 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