Cook Computing

SortedList vs HashTable: Insertion

June 10, 2002 Written by Charles Cook

In a completely unscientfic test, when adding the same collection of randomized key/value pairs to instances of HashTable and SortedList (using the default constructors for both classes), the former wins for large collections and the latter for small collections. The break-even point in my test program is in the order of 3000 pairs. However the performance of SortedList degrades in a non-linear fashion going above this number. Ensuring the initial capacity of the SortedList is sufficient for the whole collection does not make a difference to this.