[Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered (original) (raw)
Victor Stinner victor.stinner at gmail.com
Mon Sep 12 08:36:53 EDT 2016
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
2016-09-12 13:50 GMT+02:00 Antoine Pitrou <solipsis at pitrou.net>:
Besides, I don't think it has been proven that the compact-and-ordered dict implementation is actually faster than the legacy one.
Python 3.6 dict is slower than Python 3.5 dict, at least for a simple lookup: http://bugs.python.org/issue27350#msg275581
But its memory usage is 25% smaller.
I'm curious about the performance of the "compaction" needed after adding too many dummy entries (and to preserve insertion order), but I don't know how to benchmark this :-) Maybe add/remove many new keys? I expect bad performance on the compaction, but maybe not as bad as the "hash DoS".
For regular Python code, I don't expect compaction to be a common operation, since it's rare to remove attributes. It's more common to modify attributes value, than to remove them and later add new attributes.
Victor
- Previous message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Next message (by thread): [Python-Dev] Python 3.6 dict becomes compact and gets a private version; and keywords become ordered
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]