This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients rhettinger, serhiy.storchaka
Date 2018-04-17.20:32:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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)

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.
Date User Action Args
2018-04-17 20:32:06serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger
2018-04-17 20:32:06serhiy.storchakasetmessageid: <>
2018-04-17 20:32:06serhiy.storchakalinkissue33234 messages
2018-04-17 20:32:06serhiy.storchakacreate