I want to seek through massive data, grouped with multiple keys, in the fastest way possible. I have a file with this information but I want to load it in-memory. Memory capacitance is not a problem.
key1 | key2 | key3 | key4 | value1 | value2
-----|------|------|------|--------|--------
1 | 1 | 1 | 1 | str | 20
1 | 1 | 1 | 2 | str | 20
1 | 1 | 1 | 3 | str | 20
1 | 1 | 2 | 1 | str | 20
2 | 1 | 1 | 1 | str | 20
I have looked at some collections but I'm still uncertain :
http://blog.bodurov.com/Performance-SortedList-SortedDictionary-Dictionary-Hashtable
Maybe a multikey dictionary will be better because it avoid a lots of redundancy in the keys.
public class MultiKeyDictionary<T1, T2, T3> : Dictionary<T1, Dictionary<T2, T3>>
key1 | key2 | key3 | key4 | value1 | value2
-----|------|------|------|--------|--------
1 | 1 | 1 | 1 | str | 20
| | | 2 | str | 20
| | | 3 | str | 20
| | 2 | 1 | str | 20
2 | 1 | 1 | 1 | str | 20
I will not seek every keys but maybe 50% of them. I'm open to even insane suggestions.