[issue44772] Regression in memory use of instances due to dictionary ordering

2021-08-13 Thread Mark Shannon
Mark Shannon added the comment: Duplicate of https://bugs.python.org/issue40116 -- resolution: -> duplicate stage: -> resolved status: open -> closed ___ Python tracker ___

[issue44772] Regression in memory use of instances due to dictionary ordering

2021-08-04 Thread Brandt Bucher
Change by Brandt Bucher : -- nosy: +brandtbucher ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue44772] Regression in memory use of instances due to dictionary ordering

2021-08-04 Thread Mark Shannon
Mark Shannon added the comment: Raymond, When you say "this was mostly a net win" do you mean the more compact layout or ordering? The compact layout is obviously a win, and doesn't conflict with sharing. The problem is that ordering conflicts with sharing. As long as instances all have att

[issue44772] Regression in memory use of instances due to dictionary ordering

2021-08-03 Thread Raymond Hettinger
Raymond Hettinger added the comment: ISTM this was mostly a net win. We get compactness and sharing most of the time, and lose sharing only in cases like this where different instances of the same class happen to have different attributes. Personally, I would not have expected sharing to o

[issue44772] Regression in memory use of instances due to dictionary ordering

2021-07-29 Thread Mark Shannon
New submission from Mark Shannon : class C: def __init__(self, cond): if cond: self.a = 1 self.b = 2 c1 = C(True) c2 = C(False) In Python 3.5, the dictionary keys are shared - >>> sys.getsizeof(c2) 56 >>> sys.gets