Author inada.naoki
Recipients inada.naoki, jgosmann, rhettinger, serhiy.storchaka
Date 2017-03-31.03:16:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1490930216.42.0.428724391306.issue29949@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2017-03-31 03:16:56inada.naokisetrecipients: + inada.naoki, rhettinger, serhiy.storchaka, jgosmann
2017-03-31 03:16:56inada.naokisetmessageid: <1490930216.42.0.428724391306.issue29949@psf.upfronthosting.co.za>
2017-03-31 03:16:56inada.naokilinkissue29949 messages
2017-03-31 03:16:55inada.naokicreate