INADA Naoki added the comment: https://gist.github.com/methane/8faf12621cdb2166019bbcee65987e99 This patch fixes the regression.
But I think it is still larger than idiomatic. See this code: code: minused *= 2; /* Find the smallest table size > minused. */ /* XXX speed-up with intrinsics */ for (newsize = PySet_MINSIZE; newsize <= minused && newsize > 0; newsize <<= 1) ; When original minused is X, newsize will be about 2X ~ 4X. For set.add(), preserving extra space for further add() make sense. But for set_merge(), intention is avoiding repeated resize while merging. There may be not "further add()", especially for `frozenset(s)`. So 30% ~ 60% seems better than 25% ~ 50%. How do you think, Raymond? ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue29949> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com