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.

classification
Title: Oren Tirosh's fastnames patch
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: gvanrossum Nosy List: aimacintyre, brett.cannon, gvanrossum, loewis, orenti
Priority: low Keywords: patch

Created on 2002-08-20 19:20 by gvanrossum, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
fastnames2.patch gvanrossum, 2002-08-20 19:20
fastnames.tgz gvanrossum, 2002-08-20 19:31 Benchmark
Messages (13)
msg40982 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-20 19:20
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...
msg40983 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-08-20 19:31
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
msg40984 - (view) Author: Oren Tirosh (orenti) Date: 2002-09-02 19:59
Logged In: YES 
user_id=562624

I'm working on an improved version. Stay tuned!
msg40985 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-09-03 18:29
Logged In: YES 
user_id=6380

OK. I'm holding my breath! :-)
msg40986 - (view) Author: Oren Tirosh (orenti) Date: 2002-09-03 20:22
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).
msg40987 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-09-23 16:35
Logged In: YES 
user_id=6380

Oren, any chance that you'll submit a new version of this?
msg40988 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-11-14 17:31
Logged In: YES 
user_id=6380

Lowered priority until Oren uploads his long-awaited new
version.
msg40989 - (view) Author: Andrew I MacIntyre (aimacintyre) * (Python triager) Date: 2002-11-15 05:57
Logged In: YES 
user_id=250749

I notice Oren uploaded what appears to be an updated patch 
(fastnames5.patch) under patch #606098.
msg40990 - (view) Author: Andrew I MacIntyre (aimacintyre) * (Python triager) Date: 2002-11-15 06:01
Logged In: YES 
user_id=250749

I notice Oren uploaded what appears to be an updated patch 
(fastnames5.patch) under patch #606098.
msg40991 - (view) Author: Guido van Rossum (gvanrossum) * (Python committer) Date: 2002-11-15 16:54
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).
msg40992 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2003-07-06 20:16
Logged In: YES 
user_id=357491

What is the status of the mysterious new patch, Oren?
msg40993 - (view) Author: Oren Tirosh (orenti) Date: 2003-07-06 20:55
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.  
 
msg40994 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-18 11:40
Logged In: YES 
user_id=21627

Closing the patch as withdrawn/won't fix.
History
Date User Action Args
2022-04-10 16:05:36adminsetgithub: 37063
2002-08-20 19:20:52gvanrossumcreate