How can I speed up unpickling large objects if I have plenty of RAM?

前端 未结 8 911
别那么骄傲
别那么骄傲 2020-12-09 09:07

It\'s taking me up to an hour to read a 1-gigabyte NetworkX graph data structure using cPickle (its 1-GB when stored on disk as a binary pickle file).

Note that the

8条回答
  •  情话喂你
    2020-12-09 09:52

    Why don't you try marshaling your data and storing it in RAM using memcached (for example). Yes, it has some limitations but as this points out marshaling is way faster (20 to 30 times) than pickling.

    Of course, you should also spend as much time optimizing your data structure in order to minimize the amount and complexity of data you want stored.

提交回复
热议问题