[Patches] [ python-Patches-597907 ] Oren Tirosh's fastnames patch

SourceForge.net noreply@sourceforge.net
Sun, 06 Jul 2003 13:55:59 -0700


Patches item #597907, was opened at 2002-08-20 19:20
Message generated for change (Comment added) made by orenti
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=597907&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 1
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Oren Tirosh's fastnames patch

Initial Comment:
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...

----------------------------------------------------------------------

Comment By: Oren Tirosh (orenti)
Date: 2003-07-06 20:55

Message:
Logged In: YES 
user_id=562624

I have announced a few month ago on the list that I am no longer 
working on it. If anyone wants to take over I'd be happy to explain the 
ideas I had for further development of this patch to usable state and 
better performance.  
 

----------------------------------------------------------------------

Comment By: Brett Cannon (bcannon)
Date: 2003-07-06 20:16

Message:
Logged In: YES 
user_id=357491

What is the status of the mysterious new patch, Oren?

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-15 16:54

Message:
Logged In: YES 
user_id=6380

Hm, that patch doesn't have all the trickery here. Maybe
Oren can explain what his intentions were? I don't have time
to sort through all this -- if someone else wants to, that's
fine (I've got a feeling Oren has other priorities these days).

----------------------------------------------------------------------

Comment By: Andrew I MacIntyre (aimacintyre)
Date: 2002-11-15 06:01

Message:
Logged In: YES 
user_id=250749

I notice Oren uploaded what appears to be an updated patch 
(fastnames5.patch) under patch #606098.

----------------------------------------------------------------------

Comment By: Andrew I MacIntyre (aimacintyre)
Date: 2002-11-15 05:57

Message:
Logged In: YES 
user_id=250749

I notice Oren uploaded what appears to be an updated patch 
(fastnames5.patch) under patch #606098.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-11-14 17:31

Message:
Logged In: YES 
user_id=6380

Lowered priority until Oren uploads his long-awaited new
version.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-23 16:35

Message:
Logged In: YES 
user_id=6380

Oren, any chance that you'll submit a new version of this?

----------------------------------------------------------------------

Comment By: Oren Tirosh (orenti)
Date: 2002-09-03 20:22

Message:
Logged In: YES 
user_id=562624

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

No surprising considering the fact that pystone is dominated
by fastlocals (IIRC it was something like 99.7% according to
my instrumented version).

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-09-03 18:29

Message:
Logged In: YES 
user_id=6380

OK. I'm holding my breath! :-)

----------------------------------------------------------------------

Comment By: Oren Tirosh (orenti)
Date: 2002-09-02 19:59

Message:
Logged In: YES 
user_id=562624

I'm working on an improved version. Stay tuned!


----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-08-20 19:31

Message:
Logged In: YES 
user_id=6380

Tim explained why the 'globals' case is faster than the
'builtins' case. I used 'x' as the global to look up rather
than 'hex', and it so happens that the last three bits of
hash('x') and hash('MANY') are the same -- MANY is an
identifier I insert in the globals.  I'll attach the test
suite I used (with 'hex' instead of 'x'). Now I get these times:

   builtin 1.39
    global 1.28
     local 1.29
 fastlocal 0.91


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=597907&group_id=5470