Concerns about performance w/Python, Pysco on Pentiums

Tim Peters tim.one at comcast.net
Fri Mar 7 09:42:59 EST 2003


[CezaryB]
>> Tuples are faster then lists. Try this:

[Michael Hudson]
> You sure about that?
> ... [timing code] ...
> So simple subscription seems to be ~14% slower for tuples.
>
> This is Python from CVS of about a week ago, fwiw.

Note that the eval loop special-cases list, but not tuple, subscripts, in
the BINARY_SUBSCR opcode.  list[i] is done inline, tuple[i] ends up going
thru the generic PyObject_GetItem.  If there's a surprise here, then, it's
that tuple[i] isn't a *lot* slower than list[i].






More information about the Python-list mailing list