fast deep-copying of instances

Michal Vitecek fuf at
Wed Jan 28 15:13:08 CET 2004


 i have a data cache which sits between a slow database and my server and
 it's used to cache data retrieved from the database. in order for it to
 work correctly (race-conditions) i need a fast deep-copying of
 instances (the cache is used heavily).

 i tried to use copy module but it's *very* slow, then i tried cPickle
 to pickle and depickle instances which was faster, but still slow.
 then i've come across cCopy which is 8x faster than copy, but
 unfortunately it doesn't work with new style classes because type()'s
 return is crappy for them. so the question is: does there exist a fast
 copy module which works with new style classes?

    thank you,
		fuf		(fuf at

More information about the Python-list mailing list