On 15 December 2017 at 05:28, Raymond Hettinger
<raymond.hettin...@gmail.com> wrote:
> In contrast, I gave collections.OrderedDict a different design (later coded 
> in C by Eric Snow).  The primary goal was to have efficient maintenance of 
> order even for severe workloads such at that imposed by the lru_cache which 
> frequently alters order without touching the underlying dict.   
> Intentionally, the OrderedDict has a design that prioritizes ordering 
> capabilities at the expense of additional memory overhead and a constant 
> factor worse insertion time.

That's interesting information - I wasn't aware of the different
performance goals. I'd suggest adding a discussion of these goals to
the OrderedDict documentation. Now that dictionaries preserve order
(whether or not we make that language guaranteed or an implementation
detail) having clear information on the intended performance
trade-offs of an OrderedDict would help people understand why they
might choose one over the other.

Paul
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to