Using large text files & storing them in dictionary with thousands of key-value pairs

Hey guys,

I’m having some performance concerns about storing large text file’s data in dictionary. So I have this text file which has roughly 10,000 words with their multiple description. This text file is subject to grow up to 3-4 times.

I’m want to cache the data by adding the word itself as a key and its multiple descriptions as a list of descriptions as a value. This means that when the text file has matured then the number of key-value pairs would have reached approximated 40,000 for this dictionary. And I need to cache all of the file data since the levels generated will randomly select words for which I need to have all of the descriptions ready.

How much would this affect the performance considering I’m targeting mobile devices? And do I have better approach to handle this problem?

Benchmark and find out.

40,000 entries doesn’t sound like a lot, even for mobile devices. Lookup time is mostly constant with a Dictionary and the amount of memory used is unremarkable, depending on how big those lists are for your values (you didn’t provide any detail on those).