I have this code that works fine, but slow on large datasets.
I would like to hear from experts if this code can use Linq or another method, and if so, how?
Dim array_of_strings As String() ' now I add strings to my array, these come from external file(s). ' This does not take long ' Throughout the execution of my program, I need to validate millions ' of other strings. Dim search_string As String Dim indx As Integer ' So we get million of situation like this, where I need to find out ' where in the array I can find a duplicate of this exact string search_string = "the_string_search_for" indx = array_of_strings.ToList().IndexOf(search_string)
Each of the lines in my array is unique, without duplicates.
This works very well, but, as I said, is too slow for large datasets. I run this query millions of times. It currently takes about 1 minute for a million requests, but it's too slow for me.
source share