Python from Wise Guy's Viewpoint

Pascal Costanza costanza at web.de
Mon Oct 27 14:14:45 EST 2003


Fergus Henderson wrote:

> Pascal Costanza <costanza at web.de> writes:

>>Well, the research that ultimately lead to the HotSpot Virtual Machine 
>>originated in virtual machines for Smalltalk and for Self. Especially 
>>Self is an "extremely" dynamic language, but they still managed to make 
>>it execute reasonably fast.
> 
> 
> Please correct me if I'm wrong, but as I understand it, iterating over a
> collection of values is still going to require keeping some representation
> of the type of each element around at runtime, and testing the type for
> each element accessed, in case it is not the expected type.  AFAIK neither
> HotSpot nor the Self compiler do the kind of optimizations which would
> be needed to avoid that.

You don't need to check the type on each access. If you only copy a 
value from one place to other, and both places are untyped, you don't 
need any check at all.

Furthermore, if I remember correctly, dynamically compiled systems use 
type inferencing at runtime to reduce the number of type checks.


Pascal





More information about the Python-list mailing list