(original) (raw)
Make it so. "Dict keeps insertion order" is the ruling. Thanks!
On Fri, Dec 15, 2017 at 2:30 AM, INADA Naoki <songofacandy@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@gmail.com>
\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_
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/ guido%40python.org
--
--Guido van Rossum (python.org/\~guido)