You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee='https://github.com/rhettinger'closed_at=<Date2002-05-31.21:38:09.000>created_at=<Date2002-05-26.15:25:24.000>labels= ['interpreter-core']
title='Optimize list iteration'updated_at=<Date2002-05-31.21:38:09.000>user='https://github.com/rhettinger'
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.
Very close. It looks like you are using PySequence_Check()
where you should be using PyList_Check() though, since
listiter_next() really needs it to be a list! (Two place
have this mistake.)
Apart from that, it's good! (Note that the speedup
percentage is better when you use -O. :-)
Activity
rhettinger commentedon May 26, 2002
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.
gvanrossum commentedon May 31, 2002
Logged In: YES
user_id=6380
Very close. It looks like you are using PySequence_Check()
where you should be using PyList_Check() though, since
listiter_next() really needs it to be a list! (Two place
have this mistake.)
Apart from that, it's good! (Note that the speedup
percentage is better when you use -O. :-)
rhettinger commentedon May 31, 2002
Logged In: YES
user_id=80475
Replaced both instances with PyList_Check().
No other changes.
Re-verified compile, timings, and regression tests.
Okay to commit?
gvanrossum commentedon May 31, 2002
Logged In: YES
user_id=6380
Go ahead, and then close this issue!
rhettinger commentedon May 31, 2002
Logged In: YES
user_id=80475
Committed as listobject.c 2.107 and iterobject.c 1.10
Closing patch.