Message290888
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? |
|
Date |
User |
Action |
Args |
2017-03-31 03:16:56 | methane | set | recipients:
+ methane, rhettinger, serhiy.storchaka, jgosmann |
2017-03-31 03:16:56 | methane | set | messageid: <1490930216.42.0.428724391306.issue29949@psf.upfronthosting.co.za> |
2017-03-31 03:16:56 | methane | link | issue29949 messages |
2017-03-31 03:16:55 | methane | create | |
|