Help on slow attribute copy
bgs
bgs248 at hotmail.com
Wed May 18 19:03:11 EDT 2005
There's no way that loop takes fifteen minutes just because of the dot
operator. I mean, 200000 dots in 15 minutes is 200 dots/second. On a
1 GHz machine, that would be 5 million cycles per dot. That does not
seem reasonable (assuming you haven't overridden the dot operator to do
something more complicated than normal).
Check that i.label does not have __hash__ overridden in a bad way. I
tried a test case with __hash__ overridden to always return the same
integer, and I got performance about what you are describing when I
tried your example loop with 100000 iterations.
And, of course, make sure you are not low on memory and relying too
heavily on swap space.
More information about the Python-list
mailing list