[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Okay. I was going to provide patches for other set's weirdness (for example a set can increase its size after removing elements), but with your reaction I see that this doesn't make sense. I wash my hands from fixing set. --

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread INADA Naoki
INADA Naoki added the comment: OK, sorry about bothering you. -- ___ Python tracker ___ ___ Python-bugs-list

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: You guys seem to have an enormous about of spare time and seem to feel to need to redesign every single thing you see. Please slow down and allow me to breathe a bit. I cannot keep up with a new "let's change x" every single day. This set object has

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread INADA Naoki
INADA Naoki added the comment: I also feel set created from iterator is too large sometimes. Especially, frozenset is used for "unordered tuple" dict key sometimes. $ python -c 'N = 6000; from sys import getsizeof; s = [getsizeof(frozenset(range(n))) for n in range(N)]; print( [(n, s[n]) for n

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: There is a program that uses 32 GB for sets. The patch could save up to 6 GB for it. I understood your arguments when you lowered the maximal fill ration from 2/3 to 60%. But in that case the fill ratio is between 15% and 30%! Isn't it too small?

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Raymond Hettinger
Raymond Hettinger added the comment: FWIW, I've long considered this to be a feature of set and dicts, it is the only way a user can affect sparseness. For lookup only sets, the extra sparseness is a virtue (fewer collisions). So, I would like to leave the current code in-place. With

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Serhiy Storchaka
Changes by Serhiy Storchaka : -- pull_requests: +1128 ___ Python tracker ___ ___

[issue29961] More compact sets and frozensets created from sets

2017-04-01 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: For now new set and frozenset objects can allocate 2 times larger table than necessary when are created from set or dict. For example if the size n of the original set is the power of two, resulting set will allocate the table of 4*n rather that 2*n. Up