[issue28509] Key-sharing dictionaries can inrease the memory consumption

2016-10-22 Thread Xiang Zhang
Changes by Xiang Zhang : -- nosy: +xiang.zhang ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue28509] Key-sharing dictionaries can inrease the memory consumption

2016-10-22 Thread INADA Naoki
INADA Naoki added the comment: And I feel current target size of dict_merge is bit larger. When inserting new item: * ma_used = dk_size*2 / 3 when right before increasing keys * ma_used = dk_size/ 3 when right after increasing keys On the other hand, current dict_merge creates: * ma_used

[issue28509] Key-sharing dictionaries can inrease the memory consumption

2016-10-22 Thread INADA Naoki
INADA Naoki added the comment: > 0 (128, 60) > 1 (128, 60) > 2 (128, 60) > 3 (128, 60) > 4 (128, 60) > 5 (128, 60) Minimum dict keysize is 8, and it's capacity is 5. > 6 (196, 196) Dict is resized. And since __dict__.update() caused the resizing, both are normal (combined) dict. > 7 (196, 196

[issue28509] Key-sharing dictionaries can inrease the memory consumption

2016-10-22 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: The size of small key-sharing dictionary (PEP 412) can be larger than the size of normal dictionary. Python 3.6: >>> def dictsizes(k): ... d = {'a%d'%i: None for i in range(k)} ... class C: ... def __init__(self): ... self.__dic