[issue7784] patch for making list/insert at the top of the list avoid memmoves
showell
report at bugs.python.org
Fri Jan 29 11:25:58 CET 2010
showell <showell30 at yahoo.com> added the comment:
Ok, found the offending line, now all tests pass.
The use case where this patch will pay off the most is slicing your way through a list of tasks. The toy program below gets about a 50x speedup.
import time
n = 800000
lst = []
for i in range(n):
lst.append(i)
t = time.time()
for i in range(n):
x = lst[:10]
del lst[:10]
print('time = ' + str(time.time() - t))
print(len(lst))
----------
Added file: http://bugs.python.org/file16034/no_mem_penalty.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7784>
_______________________________________
More information about the Python-bugs-list
mailing list