I've read about Raymond Hettinger's new method of implementing compact dicts. This explains why dicts in Python 3.6 use less memory than dicts in Python 2.7-3.5. However there seems to be a difference between the memory used in Python 2.7 and 3.3-3.5 dicts. Test code:
import sys
d = {i: i for i in range(n)}
print(sys.getsizeof(d))
- Python 2.7: 12568
- Python 3.5: 6240
- Python 3.6: 4704
As mentioned I understand the savings between 3.5 and 3.6 but am curious about the cause of the savings between 2.7 and 3.5.