summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorRaymond Hettinger <python@rcn.com>2004-02-15 04:06:39 (GMT)
committerRaymond Hettinger <python@rcn.com>2004-02-15 04:06:39 (GMT)
commitfa7b9d8255e2bb5705de82468ff5ff1dc001e5e9 (patch)
tree364ab1416f00931bf6aa04590c1842d5328b7fb4 /Misc
parent90a39bf12c96c47a45c9b7ce3b10f3a3817bd5ac (diff)
downloadcpython-fa7b9d8255e2bb5705de82468ff5ff1dc001e5e9.zip
cpython-fa7b9d8255e2bb5705de82468ff5ff1dc001e5e9.tar.gz
cpython-fa7b9d8255e2bb5705de82468ff5ff1dc001e5e9.tar.bz2
* Moved the responsibility for emptying the previous list from list_fill
to list_init. * Replaced the code in list_extend with the superior code from list_fill. * Eliminated list_fill. Results: * list.extend() no longer creates an intermediate tuple except to handle the special case of x.extend(x). The saves memory and time. * list.extend(x) runs about the same x is a list or tuple, a little faster when x is an iterable not defining __len__, and twice as fast when x is an iterable defining __len__. * the code is about 15 lines shorter and no longer duplicates functionality.
Diffstat (limited to 'Misc')
-rw-r--r--Misc/NEWS5
1 files changed, 5 insertions, 0 deletions
diff --git a/Misc/NEWS b/Misc/NEWS
index a5fd9c4..4f16e2e 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -12,6 +12,11 @@ What's New in Python 2.4 alpha 1?
Core and builtins
-----------------
+- Optimized list.extend() to save memory and no longer create
+ intermediate sequences. Also, extend() now pre-allocates the
+ needed memory whenever the length of the iterable is known in
+ advance -- this halves the time to extend the list.
+
- Optimized list resize operations to make fewer calls to the system
realloc(). Significantly speeds up list appends, list pops,
list comprehensions, and the list contructor (when the input iterable