From: moshez at math.huji.ac.il (Moshe Zadka)
Date: Thu, 29 Apr 1999 20:32:05 +0300
Subject: Python IS slow ! [was] Re: Python too slow for real world
In-Reply-To: <7g9qmo$luf$1@news.udel.edu>
References: <613145F79272D211914B0020AFF6401914DAD8@gandalf.digicool.com> <p5g15lmb35.fsf@bidra241.bbn.hp.com> <slrn7ieipq.8uk.wtanksle@dolphin.openprojects.net> <7g9qmo$luf$1@news.udel.edu>
Message-ID: <Pine.SUN.3.95-heb-2.07.990429203025.15824C-100000@sunset.ma.huji.ac.il>
X-UID: 215                                                  

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.






