Message315412
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. | |
Date | User | Action | Args | 2018-04-17 20:32:06 | serhiy.storchaka | set | recipients: + serhiy.storchaka, rhettinger | 2018-04-17 20:32:06 | serhiy.storchaka | set | messageid: <1523997126.24.0.682650639539.issue33234@psf.upfronthosting.co.za> | 2018-04-17 20:32:06 | serhiy.storchaka | link | issue33234 messages | 2018-04-17 20:32:06 | serhiy.storchaka | create | | |