cPickle alternative?

Alex Martelli aleaxit at yahoo.com
Fri Aug 15 10:57:42 EDT 2003


Drochom wrote:

> Hello,
>     I have a huge problem with loading very simple structure into memory
>     it is a list of tuples, it has 6MB and consists of 100000 elements
> 
>>import cPickle
> 
>>plik = open("mealy","r")
>>mealy = cPickle.load(plik)
>>plik.close()
> 
>     this takes about 30 seconds!
>     How can I accelerate it?
> 
> Thanks in adv.

What protocol did you pickle your data with?  The default (protocol 0,
ASCII text) is the slowest.  I suggest you upgrade to Python 2.3 and
save your data with the new protocol 2 -- it's likely to be fastest.


Alex





More information about the Python-list mailing list