You're a good looking blog, what's your owner's name?

Richard Jonas's blog about .NET, web development and agile methodologies.

Tuesday, October 10

C# collection classes performance

I was looking for a table summarizing how different C# generic and non-generic collection classes performed, relative to one another, thought there would be hundreds available, but could not find one. So here one is for my future reference, and for anyone else who reads this.



O(1) = constant time
O(log n) = time proportional to the log of the number of elements in the collection
O(n) = time proportional to the number of elements in the collection

Some collections are better for smaller collections, but don't scale to larger ones. The List, LinkedList, SortedList, Queue and Stack classes are better for smaller collections than the Dictionary, Hashtable and SortedDictionary classes.

1 Comments:

  • At 3:10 PM, Anonymous Anonymous said…

    useful, thanks

     

Post a Comment

Links to this post:

Create a Link

<< Home