-
Book Overview & Buying
-
Table Of Contents
.NET 4.0 Generics Beginner's Guide
By :
How much time does it take to find the last index of an item in a list-based collection?
If you go by your intuition, it might seem obvious that the container that offers the lowest time for first index lookup of a given element will do so for the last index of occurrence too. However, soon you shall find that's not the case. Here, we shall benchmark the same containers as in the previous one.
The benchmarking code will be exactly the same. Except, instead of the IndexOf() method, you have to call the LastIndexOf() method on the containers.
The following is the result for all these containers:

The graph depicting the relative performance of all these containers for this operation is as follows:

And the following is what I got putting the data to Wordle, as I did earlier:

From the previous graph, it is pretty much evident that C5.LinkedList<T>, C5.ArrayList<T>, and List<T> offer equivalent performance. Anything beyond these collections would be...
Change the font size
Change margin width
Change background colour