A vision for Parrot

Terry Reedy tjreedy at udel.edu
Wed Nov 6 14:42:53 EST 2002


"Robin Becker" <robin at jessikat.fsnet.co.uk> wrote in message
> I think that python allows any reference to change type dynamically.

Better put: python allows names to be dynamically rebound to
(reference to) object of any type regardless of previous binding.

> 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. 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.
>
> As you point out psyco can do the compilation, but only into the
generic
> multiply (unless psyco can be hinted in some way).

I believe that Psycho *does* compile to specific int multiply.  Hence
up to 10x speedup.  That's what Armin means by 'specializing'
compiler.  The same 'x*y' could also be compiled to float multiply if
that also happens on another entry to same code.  Correct version
would be selected as needed.  Process has setup time and space
overhead, which is why programmer must specify (inner) functions to
psyco-ize.

Terry J. Reedy





More information about the Python-list mailing list