]> granicus.if.org Git - python/commit
list_resize() now has an "exact" option for bypassing the overallocation
authorRaymond Hettinger <python@rcn.com>
Sun, 14 Mar 2004 06:42:23 +0000 (06:42 +0000)
committerRaymond Hettinger <python@rcn.com>
Sun, 14 Mar 2004 06:42:23 +0000 (06:42 +0000)
commit0e91643bd27132554546465d37bcc01573768aa6
tree7837131aba76b97310b085572c7a90d0d0f82765
parent49f9bd15ffeef67358a319f89faeaa31ad97d575
list_resize() now has an "exact" option for bypassing the overallocation
scheme in situations that likely won't benefit from it.  This further
improves memory utilization from Py2.3 which always over-allocates
except for PyList_New().

Situations expected to benefit from over-allocation:
    list.insert(), list.pop(), list.append(), and list.extend()

Situations deemed unlikely to benefit:
    list_inplace_repeat, list_ass_slice, list_ass_subscript

The most gray area was for listextend_internal() which only runs
when the argument is a list or a tuple.  This could be viewed as
a one-time fixed length addition or it could be viewed as wrapping
a series of appends.  I left its over-allocation turned on but
could be convinced otherwise.
Objects/listobject.c