Faster copying of composite new-class objects
John J. Lee
jjl at pobox.com
Thu Dec 22 17:58:03 EST 2005
"Alex" <OurLab at gmail.com> writes:
> 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__.
At a wild guess: writing custom serialisation functions using module
marshal?
John
More information about the Python-list
mailing list