My initial problem is that I need to implement a very fast, sparse array in C#. Original idea was to use a normal Dictionary<uint, TValue>
and wrap it in my own class to only expose the TValue
type parameter. Turns out this is pretty slow.
So my next idea was to map each integer in the needed range (UInt32.MinValue
to UInt32.MaxValue
) to a bucket, of some size and use that. So I'm looking for a good way to map an unsigned integer X to a bucket Y, for example:
Mapping the numbers 0-1023 to 8 different buckets holding 128 numbers each, 0-127, 128-255.
But if someone has a better way of implementing a fast sparse array in C#, that would be most appreciated also.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…