list.pop(0) vs. collections.dequeue

Aahz aahz at pythoncraft.com
Sat Jan 23 19:50:42 CET 2010


In article <8e4d3fe2-c4bd-4a73-9c50-7a336dab25be at o28g2000yqh.googlegroups.com>,
Steve Howell  <showell30 at yahoo.com> wrote:
>On Jan 22, 11:10=A0pm, a... at pythoncraft.com (Aahz) wrote:
>>
>>>I know Python's number one concern will never be speed, but if Python
>>>makes an O(1) operation into an unnecessarily O(N) operation for no
>>>good reasons other than "it's too complicated, " or it "adds another
>>>pointer to the structure," or "it adds another conditional check to
>>>list_ass_slice for operations that aren't popping off the top," I
>>>think it's reasonable to challenge the design philosophy.
>>
>> "Rough consensus and running code."
>>
>> You have a good point, but nobody will ever give your idea serious
>> attention until there's a patch and benchmarks.
>
>Here is a benchmark of O(N*N) vs. O(N) for two C programs.  One does
>memmove; the other simply advances the pointer.

You should provide pybench numbers and probably also use the benchmarks
produced by the Unladen Swallow project.  The next step is to file a
patch on bugs.python.org and request review.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

import antigravity



More information about the Python-list mailing list