huge slowdown on append

ianaré ianare at gmail.com
Fri Dec 21 15:29:32 EST 2007


Hey all,

I have a for loop which included the line:

items_ren.append(join(newPath,renamedItem))

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!

Can anyone give me some pointers please? I would like to keep the same
structure if possible, as it allows the code in other places to be
much faster. TIA

BTW, the 'join' function is this:
def join(newPath,renamedItem):
            return unicode(os.path.join(newPath,renamedItem))



More information about the Python-list mailing list