Python IS slow ! [was] Re: Python too slow for real world

Moshe Zadka moshez at math.huji.ac.il
Thu Apr 29 13:32:05 EDT 1999


On 29 Apr 1999, Terry Reedy wrote:

> >The reason it's slow is its runtime model.  _Every_ function call requires
> >a lookup in a hash table, just on the off-chance that the programmer
> >changed the meaning of the function.
> 
> A batch-mode optimizer analyzing an entire file (module) should be able to 
> detect whether or not function names are rebound.

Or a human optimizer, might do something like

(old code)
for i in a:
	f(a)
(new code)
lf=f
for i in a:
	lf(a)

Python (I believe) optimizes local variable lookups.
--
Moshe Zadka <mzadka at geocities.com>. 
QOTD: My own exit is more likely to be horizontal then perpendicular.






More information about the Python-list mailing list