[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered

Antoine Pitrou solipsis at pitrou.net
Mon Sep 12 07:50:38 EDT 2016


On Fri, 9 Sep 2016 14:01:08 -0500
David Mertz <mertz at gnosis.cx> wrote:
> It seems unlikely, but not inconceivable, that someday in the future
> someone will implement a dictionary that is faster than current versions
> but at the cost of losing inherent ordering.

I agree with this.  Since ordering is a constraint, in abstracto it is
quite understandable that relaxing a constraint may enable more
efficient algorithms or implementations.

Besides, I don't think it has been proven that the compact-and-ordered
dict implementation is actually *faster* than the legacy one.  It is
more compact, which can matter in some contexts (memory-heavy workloads
with lots of objects, perhaps), but not necessarily others.

Regards

Antoine.




More information about the Python-Dev mailing list