Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka
Date 2018-04-17.20:32:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1523997126.24.0.682650639539.issue33234@psf.upfronthosting.co.za>
In-reply-to
Content
Calling PyObject_LengthHint() adds an overhead. It is significant for short sequences. I work on a patch that reduces it. PR 6493 adds the second call of PyObject_LengthHint() and increases the overhead.

As for this issue, in-place repeat overallocates too.

>>> a = [0]; a *= 10; getsizeof(a)
200

I think it would be better to make it not preallocating.

And maybe it would be worth to avoid overallocating if newsize > allocated + allocated/8 or something like.
History
Date User Action Args
2018-04-17 20:32:06serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger
2018-04-17 20:32:06serhiy.storchakasetmessageid: <1523997126.24.0.682650639539.issue33234@psf.upfronthosting.co.za>
2018-04-17 20:32:06serhiy.storchakalinkissue33234 messages
2018-04-17 20:32:06serhiy.storchakacreate