cPickle asymptotic performance?

Hrvoje Niksic hniksic at xemacs.org
Thu Jun 12 14:57:51 EDT 2008


Eric Jonas <jonas at MIT.EDU> writes:

> I've done some benchmarking while attempting to serialize my (large)
> graph data structure with cPickle; I'm seeing superlinear performance
> (plotting it seems to suggest n^2 where n is the number of nodes of my
> graph), in the duration of the pickle.dump calls and I can't quite
> figure out why.

Try gc.disable() before loading the pickle, and gc.enable() after.

> Is cPickle's behavior known to be O(n^2)?

No, but the garbage collector's sometimes is.



More information about the Python-list mailing list