Здравствуйте, Lloyd, Вы писали:
L>А может MultiDictionary из PowerCollections глянуть?
const int FillCount = 10 * 1000;
const int ChangeEvery = 100;
const int UniqCount = 1000;
public static void TestStorageIndex()
{
PerfHelper.Measure("MultiDictionary", () =>
{
MultiDictionary<int, int> storage = new MultiDictionary<int, int>(false);
for (int i = 0; i < FillCount * 500; i++)
{
storage.Add(i % UniqCount, i);
if (i % 1001 == 0)
{
int a = storage[i % UniqCount].Count;
}
}
});
PerfHelper.Measure("SortedSet", () =>
{
StorageIndex<int> storage = new StorageIndex<int>(null);
for (int i = 0; i < FillCount * 500; i++)
{
storage.AddIndex(i % UniqCount, i);
if (i % 1001 == 0)
{
storage.IndexesOf(i % UniqCount);
}
}
});
}
-------
MultiDictionary:
Elapsed: 62.8747s, MemDelta: 33,13 MB, GC count: 15
-------
SortedSet:
Elapsed: 04.4208s, MemDelta: 115,72 MB, GC count: 32
-------
HashSet:
Elapsed: 01.8388s, MemDelta: 135,84 MB, GC count: 59
-------
List:
Elapsed: 02.3754s, MemDelta: 36,82 MB, GC count: 41
Done. Press any key to exit...
Как-то так