diff options
author | Raymond Hettinger <python@rcn.com> | 2004-02-15 03:57:00 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2004-02-15 03:57:00 (GMT) |
commit | 90a39bf12c96c47a45c9b7ce3b10f3a3817bd5ac (patch) | |
tree | 7ee5f0c729e788c8741a63770ba1a34d50f344d2 /Misc | |
parent | ab517d2eacba7fec5f31dd25b8e43dca678cda53 (diff) | |
download | cpython-90a39bf12c96c47a45c9b7ce3b10f3a3817bd5ac.zip cpython-90a39bf12c96c47a45c9b7ce3b10f3a3817bd5ac.tar.gz cpython-90a39bf12c96c47a45c9b7ce3b10f3a3817bd5ac.tar.bz2 |
Refactor list_extend() and list_fill() for gains in code size, memory
utilization, and speed:
* 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
5 to 10% faster when x is a list or tuple
15% faster when x is an iterable not defining __len__
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')
0 files changed, 0 insertions, 0 deletions