Faster copying of composite new-class objects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Alex

    #1

    Faster copying of composite new-class objects

    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.de epcopy(obj). Is there any way to do it even faster?

    All objects have slots, __getstate__ and __setstate__.

    TIA,

    Alex

  • John J. Lee

    #2
    Re: Faster copying of composite new-class objects

    "Alex" <OurLab@gmail.c om> writes:
    [color=blue]
    > 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.de epcopy(obj). Is there any way to do it even faster?
    >
    > All objects have slots, __getstate__ and __setstate__.[/color]

    At a wild guess: writing custom serialisation functions using module
    marshal?


    John

    Comment

    Working...