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: GETCONST/GETNAME/GETNAMEV speedup
Type: Stage:
Components: Interpreter Core Versions: Python 2.3
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: skip.montanaro Nosy List: nnorwitz, skip.montanaro, tim.peters
Priority: normal Keywords: patch

Created on 2002-01-21 13:39 by skip.montanaro, last changed 2022-04-10 16:04 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
ceval.diff skip.montanaro, 2002-08-02 16:58
Messages (8)
msg38783 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-01-21 13:39
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
msg38784 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-01-21 13:47
Logged In: YES 
user_id=44345

Whoops...  Make the "observed" speedup 0.1%...
msg38785 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-07-09 23:45
Logged In: YES 
user_id=44345

Looking for a vote up or down on this one...
msg38786 - (view) Author: Neal Norwitz (nnorwitz) * (Python committer) Date: 2002-07-23 03:34
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?
msg38787 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-07-23 22:04
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.
msg38788 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-08-02 16:58
Logged In: YES 
user_id=44345

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

msg38789 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2002-08-03 01:20
Logged In: YES 
user_id=31435

Cool -- check it in!
msg38790 - (view) Author: Skip Montanaro (skip.montanaro) * (Python triager) Date: 2002-08-04 21:04
Logged In: YES 
user_id=44345

checked in as ceval 2.231
History
Date User Action Args
2022-04-10 16:04:54adminsetgithub: 35959
2002-01-21 13:39:01skip.montanarocreate