Faster copying of composite new-class objects

Alex OurLab at gmail.com
Sat Dec 17 12:14:55 EST 2005


Hi,

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__.

TIA,

Alex




More information about the Python-list mailing list