memory usage #54
virtualluke
started this conversation in
General
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. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
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
All reactions