[Patches] [ python-Patches-560736 ] Optimize list iteration

noreply@sourceforge.net noreply@sourceforge.net
Sun, 26 May 2002 08:25:24 -0700


Patches item #560736, was opened at 2002-05-26 10:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=305470&aid=560736&group_id=5470

Category: Core (C code)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Raymond Hettinger (rhettinger)
Assigned to: Guido van Rossum (gvanrossum)
Summary: Optimize list iteration

Initial Comment:
Filled listobject's tp_iter slot with it's own iterator.  
Speeds looping 5 to 10% (YMMV).

Only half of the speed-up comes from using tp_iter.  
The rest came from code tweaking:
-- eliminate the it variable
-- invert the limit test to avoid jumps
-- bypass the GET_ITEM macro to allow index++ to be 
combined with the lookup.



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

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