[Patches] [ python-Patches-506436 ] GETCONST/GETNAME/GETNAMEV speedup

noreply@sourceforge.net noreply@sourceforge.net
Fri, 02 Aug 2002 18:20:56 -0700


Patches item #506436, was opened at 2002-01-21 08:39
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=506436&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
>Resolution: Accepted
Priority: 5
Submitted By: Skip Montanaro (montanaro)
>Assigned to: Skip Montanaro (montanaro)
Summary: GETCONST/GETNAME/GETNAMEV speedup

Initial Comment:
The attached patch redefines the GETCONST, GETNAME &
GETNAMEV 
macros to do the following:

  * access the code object's consts 
and names through
    local variables instead of the long chain from 
f

  * use access macros to index the tuples and get
    the C string 
names

The code appears correct, and I've had no trouble
with 
it.  It only provides the most trivial of
improvement on pystone 
(around 1% when I see
anything), but it's all those little things 
that
add up, right?

Skip


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

>Comment By: Tim Peters (tim_one)
Date: 2002-08-02 21:20

Message:
Logged In: YES 
user_id=31435

Cool -- check it in!

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

Comment By: Skip Montanaro (montanaro)
Date: 2002-08-02 12:58

Message:
Logged In: YES 
user_id=44345

Here's an updated patch.  Back to Tim...



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

Comment By: Tim Peters (tim_one)
Date: 2002-07-23 18:04

Message:
Logged In: YES 
user_id=31435

Marked Out-of-Date and back to Skip.  Sorry for the delay!

The idea is fine.  I'd rather you use the current GETITEM 
macro, which does bounds-checking in a debug build.  I note 
too that GETCONST is only used once, and that use may as 
well be a direct GETITEM(consts, i) invocation, and skip the 
macro.  Note that the GETNAME() macro no longer exists.

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-07-22 23:34

Message:
Logged In: YES 
user_id=33168

Skip, I modified this code some, but your technique is still
valid.  I got rid of one of the indirections already.  The
patch can easily be updated.  Seems like the patch shouldn't
hurt.  Tim?

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

Comment By: Skip Montanaro (montanaro)
Date: 2002-07-09 19:45

Message:
Logged In: YES 
user_id=44345

Looking for a vote up or down on this one...


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

Comment By: Skip Montanaro (montanaro)
Date: 2002-01-21 08:47

Message:
Logged In: YES 
user_id=44345

Whoops...  Make the "observed" speedup 0.1%...


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

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