memory usage #54
Replies: 1 comment
-
Because frozendict is a map as dict, so it must have anyway a sparse hashtable, or the access by key will be no more O(1). dict was already made more compact in Python 3.6, using the Pypy model. In theory, one could create a PyFrozendictKeysObject, without:
Furthermore, one could remove from PyFrozendictObject:
I don't think it will be a great memory save. These attributes are per dict, not per item, so the memory save will be very low. On the contrary, there's the possibility to make it completely incompatible with dictobject.c functions. Actually, frozendict is a little more big than dict, since it also has a cache for the hash. |
Beta Was this translation helpful? Give feedback.
-
Are there any benchmarks with the difference in memory usage over a standard dict? I would hope a rather large improvement with the immutable nature.
thanks,
Luke
Beta Was this translation helpful? Give feedback.
All reactions