efficient idiomatic queue?

Delaney, Timothy tdelaney at avaya.com
Thu Jan 17 18:10:43 EST 2002


> From: Raymond Hettinger [mailto:othello at javanet.com]
> "Delaney, Timothy" <tdelaney at avaya.com> wrote in message
> news:mailman.1011232764.16285.python-list at python.org...
> >
> > 10000    <type 'list'>        0.329070
> > 10000    <type 'array'>       0.234557
> > 10000    DictIntFifo          0.123809
> > 10000    DictLongFifo         0.185284
> > 10000    ListPrependFifo      0.329698
> > 10000    ListAppendFifo       0.398269
> >
> > 100000   <type 'list'>        76.195043
> > 100000   <type 'array'>       56.828019
> > 100000   DictIntFifo          1.269020
> > 100000   DictLongFifo         1.961017
> > 100000   ListPrependFifo      60.693928
> > 100000   ListAppendFifo       77.094517
> >
> > So once you get to decently large quantities in the queue, the dict
> versions
> > make real sense over a basic list (Win2000).
> >
> > Tim Delaney
> 
> 
> Before drawing a conclusion on this one, please add Sébastien Keim's
> approach
> to the mix:

No question - there's lots of ways to do a FIFO list. I was merely
interested in how well Alex's version would perform compared to the naive
method of just using a list. And then of course I buggered up the test (in
two different ways!) and felt it important to acknowledge this and correct
any misconceptions that the dict method was inefficient which were formed
based on my erroneous test.

Tim Delaney




More information about the Python-list mailing list