Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment: 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. ---------- nosy: +serhiy.storchaka _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue33234> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com