Faster copying of composite new-class objects

Alex OurLab at
Sat Dec 17 18:14:55 CET 2005


My program requires copying thousands of composite new-class objects. I
found that the following: objCopy=cPickle.loads(cPickle.dumps(obj,
protocol=2)) works about 4 times faster than
copyObj=copy.deepcopy(obj). Is there any way to do it even faster?

All objects have slots, __getstate__ and __setstate__.



More information about the Python-list mailing list