Comparing C# Collection Classes

While I was looking for a way to optimize flexible searches in my collections stored in memory, I came across this page. It has a great list with just the information I needed when deciding witch collection class to use for my memory indexes. I have collections with up to 1 million objects in them and I want (if possible) to retrieve subsets of them in less than 100 ms. And since each subset selections queries several properties randomly, I’m trying to optimize it with memory indexes.


My first plan was to scan multiple (sorted) indexes at the same time, but that was not as fast as I thought it would be. Currently the fastest way is to compare indexes two and two to get the intersection. My first try with Dictionary<T, T> was very fast, but used far too much memory. So the best way right now is to use List<T> (with IDs of int) and find intersections of indexes by looping and searching with BinarySearch().

Here is some more information about the BinarySearch():