delegate () { solve(everything); }

Call me Ishmael.

C#: Dictionary<TKey, TValue> performance

For the first time since the introduction of generics in the .Net framework I needed to create a lookup by key collection with good performance. For this I have always used the HashTable or HashMap (in Java), and I was hesitant to have to move to the Dictionary collection.

Fortunately, the performance turns out to be very good! Chris Neuman has done a Dictionary<TKey, TValue> vs HashTable comparison that correctly reflects my needs. I have previously seen performance comparisons but that left out the boxing/unboxing with the HashTable data. Which, in my experience, is always needed in real-life code.

Go see the numbers for yourself. Me, I’m taking the generic dictionary and running with it. So long!

May 13, 2008 Posted by Morten Petteroe | Programming | | No Comments Yet