In C #, I have some static data that can be placed in Dictionary<int, T> , where T is some reference type. A web application only needs to be initialized once, statically (it does not change).
Since I don't have to worry about inserting or removing performance, what is the best data structure to use (or should I use it myself)? I probably look at something like ~ 100,000 records, fairly evenly distributed.
I am looking for an optimal algorithm to extract this data. Dictionary<> not bad, but I would suggest that there should be something optimized for read-only data.
I suspect, but did not confirm, that the range of these keys can be 0 - 400 000. If this were so, how would the recommendations change? (I have an idea that I will post as a possible answer).
Perhaps I could:
- Scan the data once and take the top key
- Select an array with a maximum key of + 1.
- Make the second pass and save the data in an array.
Would it be better or worse than a HashTable / Dictionary with a reasonable load factor?
source share