A vision for Parrot

holger krekel pyth at devel.trillke.net
Wed Nov 6 14:04:55 EST 2002


Robin Becker wrote:
> In message <20021106184401.X30315 at prim.han.de>, holger krekel
> <pyth at devel.trillke.net> writes
> .....
> >I am not sure i understand this.  Why does python need to enter
> >restricted mode?  
> >
> >And doesn't PSYCO also do JIT-alike compiling?  That's at least how
> >i understood Armin.  As he also suggests to rewrite the python-core
> >in python to make it faster (with psyco) maybe this could help
> >with an c#-interpreter?  
> >
> >wildly-guessing'ly yours,
> >
> >    holger
> >
> I think that python allows any reference to change type dynamically.

There are some restrictions especially with new-style classes. 

> I don't think C# allows this, but am no expert. The implication is that
> C# can be very much more agressive in its JIT compilation.

PSYCO is - in effect - extremly aggressive about optimization.  It works
with the actual runtime types and defers compilation until type
information is available (when the execution path hits it). It allows
for multiple optimized code sets for one place.  Depending on the
actually arriving types one code-fragment of the code set is choosen.
PSYCO emits machine code.  

You might like to take a look at

    http://psyco.sourceforge.net

if you didn't already.  

> When it sees
> x*y for x and y known ints it can compile an integer multiply. Python
> only sees x*y and without the type information it is forced to do type
> lookup at run time.

Psyco will optimize this in common cases to a single machine
code instruction.  Furthermore it might completly sum up compuations
with constants.  But Psyco doesn't have any specializing optimizer. 
This is all a result of how PSYCO works.  

The more of the interpreter is written in python the more it 
can optimize.  That's because it can't really do much
about compiled machine code (C-extensions, C-core).

OM'ly 

    holger




More information about the Python-list mailing list