[Python-Dev] Guarantee ordered dict literals in v3.7?

Guido van Rossum guido at python.org
Fri Dec 15 10:53:40 EST 2017


Make it so. "Dict keeps insertion order" is the ruling. Thanks!

On Fri, Dec 15, 2017 at 2:30 AM, INADA Naoki <songofacandy at gmail.com> wrote:

> > That's interesting information - I wasn't aware of the different
> > performance goals.
>
> FYI, performance characteristic of my POC implementation of
> OrderedDict based on dict order are:
>
> * 50% less memory usage
> * 15% faster creation
> * 100% (2x) faster iteration
> * 20% slower move_to_end
> * 40% slower comparison
>
> (copied from https://bugs.python.org/issue31265#msg301942 )
>
> Comparison is very unoptimized at the moment and I believe it can be
> more faster.
> On the other hand, I'm not sure about I can optimize move_to_end() more.
>
> If OrderdDict is recommended to be used for just keeping insertion order,
> I feel 1/2 memory usage and 2x faster iteration are more important than
> 20% slower move_to_end().
>
> But if either "dict keeps insertion order" or "dict keeps insertion order
> until
> deletion" is language spec, there is no reason to use energy and time for
> discussion of OrderedDict implementation.
>
> Regards,
>
> INADA Naoki  <songofacandy at gmail.com>
> _______________________________________________
> Python-Dev mailing list
> Python-Dev at python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>



-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171215/094132bf/attachment.html>


More information about the Python-Dev mailing list