This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author gvanrossum
Recipients
Date 2002-08-20.19:20:52
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Oren Tirosh had a nice patch to *really* speed up
global/builtin name lookup. I'm adding it here because
I don't want to lose this idea.

His code and some comments are here:

http://www.tothink.com/python/fastnames/

I'm uploading a new version of this patch relative to
current CVS.

I'm still considering whether to do this; I measure at
best a 1% speedup for pystone.

For a modified version of Oren's benchmark (modified to
use a function instead of a class for 'builtin' and
'global', so that these tests use LOAD_GLOBAL rather
than LOAD_NAME, I get these test results (best of 3):

   builtin 1.38
    global 1.54
     local 1.28
 fastlocal 0.90

Python 2.3 without his patch (but with my speedup hacks
in LOAD_GLOBAL):

   builtin 1.80
    global 1.52
     local 1.77
 fastlocal 0.91

Python 2.2 (from the 2.2 branch, which is newer than
the 2.2.1 release but doesn't have any speedups) did this:

   builtin 2.28
    global 1.86
     local 1.80
 fastlocal 1.10

I don't care about the speedup for the 'local' case,
since this uses the LOAD_NAME opcode which is only used
inside class definitions; the 'builtin' and 'global'
cases are interesting. It looks like Oren's patch gives
us a nice speedup for looking up a built-in name from a
function. I have to think about why looking up a global
from a function is slower though...
History
Date User Action Args
2007-08-23 15:14:50adminlinkissue597907 messages
2007-08-23 15:14:50admincreate