List Performance
Peter Otten
__peter__ at web.de
Mon Jun 30 03:23:46 EDT 2008
Ampedesign wrote:
> If I happen to have a list that contains over 50,000 items, will the
> size of the list severely impact the performance of appending to the
> list?
No.
$ python -m timeit -n20000 -s"items = []" "items.append(42)"
20000 loops, best of 3: 0.554 usec per loop
$ python -m timeit -n20000 -s"items = [42]*10**6" "items.append(42)"
20000 loops, best of 3: 0.529 usec per loop
http://wiki.python.org/moin/TimeComplexity
Peter
More information about the Python-list
mailing list