I have a DataTable/collection that is cached in memory, I want to use this as a source to generate results for an auto complete textbox (using AJAX of course). I am evaluating various options to fetch the data quickly. The number of items in the collection/rows in the datatable could vary from 10000 to 2,000,000. (So that we dont get diverted, for the moment assume that the decision has been made, I have ample RAM and I will be using the cache and not database query for this)
I have some additional business logic for this processing; I have to prioritize the auto complete list as per a priority
column (int) in the collection. So if I someone searches for Micro
and I get say 20 results of words/sentences that start with Micro
then I would pick the top 10 resultant items with highest priority. (hence the need to have a priority property associated with the string value).
The collection items are already sorted alphabetically.
What would be the best solution in this case.
1. Using DataTable.Select(.
2. Using DataTable.Rows.Find(.
3. use a custom collection with foreach or for to iterate through its values.
4. use a generic collection with anonymous delegates or lambda (since both give same performance or not?)