Alan Gauld wrote:

I needed to copy this matrix to 'self.old_data', so I have been


using


.deepcopy(), which works OK but is SLOW .... (12+ secs)



Are you sure you need to copy it./ A simple reassignment should work and then reconstruct the structure using fresh lists/dictionary etc. That should work faster.

Alan G.



Yep this is what I ended up doing, 12+ secs becomes 0.5 sec :-)

My query was To speed things up I changed my code to

# This is the speeded up deepcopy()
self.old_data = self.data
self.data = []
for i in range(110):
  self.data.append({})

Query: Is all this OK, it works and quick as well, but I am concerned I may be leaving garbage in the Python PVM since I am shrugging off old 'self.old_data's which may be mounting up ?

But apparently this is ok (as he cancelles order gor 1GB RAM ;-) )

Dave
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to