python improvements (Was: Re: New Language)

Moshe Zadka moshez at math.huji.ac.il
Sat May 13 02:40:19 EDT 2000


On 12 May 2000, Neel Krishnaswami wrote:

> If you can declare that a variable is a machine integer or float, and
> arrays of the same, you have enough information to get about 80% of
> the speed benefit that static typing can win you.

What about array-based member lookup, vs. dict-based? I.e., if we can
optimize foo.bar to be either a 1) compile-time error or 2) an index to
the member array, it will speed up quite a lot of code.

> Before static typing for speed is tried (with its complicating effects
> on implementation), I think it's better to go for the factor of 2
> improvement that can be won via easy tricks like method caches,
> variable lookup optimization, and reducing function call
> overhead. (Look at Squeak Smalltalk for an example.)

Can you give some kind of reference, beside the Squeak Smalltalk source
code? How easy are the tricks?

> Note also that it can be hard to declare 'machine integer' as a type,
> if type-class unification becomes reality and you can subclass
> Integer.

Not if we have a type system which will allow you to say "an int, and
nothing else. Not a subclass". I'm very much in favour of such a
type-system, but I'm a minority -- this seems an OPT-based target, and
most type-sig people are ERR people.

--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list