I have large dictionary matching keys (which are strings) for objects. I pickled this large dictionary, and at certain points I want to pull out only a few entries from it. A dictionary usually contains thousands of entries. When I load a dictionary using pickle as follows:
from cPickle import *
mydict = open(load('mypickle.pickle'))
for entry in relevant_entries:
value = mydict[entry]
I noticed that it might take up to 3-4 seconds to load the whole brine that I don't need, as I get access to a tiny subset of the words in the dictionary later (shown above).
How can I make it so that crumbling only downloads the entries that I have from the dictionary to make it faster?
Thank.
source
share