huge slowdown on append
Fredrik Lundh
fredrik at pythonware.com
Fri Dec 21 16:37:33 EST 2007
ianaré wrote:
>> I changed it to this:
>> items_ren.append([join(newPath,renamedItem), False])
>>
>> And processing speed is now much much slower. For 5780 items the old
>> function would take 9.5 seconds (there is other stuff going on
>> obviously), after changing that single line, speed is now 55 seconds
>> in the same conditions!
have you checked the process size? short lists are relatively expensive
to create, both performance-wise, and more importantly, memory-wise.
try using tuples instead.
or better, move the flags to a separate data structure (either a list,
or, if possible, a set or dictionary keyed on filenames).
</F>
More information about the Python-list
mailing list