I have a ListOf(Type that I've created that will often have well over 20-thousand entries.
The type I am placing into the list looks like this:
Before I add anything to the list I need to check and make sure it's not already in there:
...but with anything above about 7-thousand entries it takes about 1/4 to 1/2 second for each comparison. With more than 15-thousand it takes nearly a second. If I am adding a total of 20-thousand records I could miss Christmas!
I *thought* it would be faster to try
But this throws an exception ("failed to compare") - so either this is not what I want or I am just doing it wrong.
I also thought I might throw a hash into the structure and then force the CONTAINS or BINARYSEARCH method to only compare hashes - but I just can't figure out how to do that... Also - just how unique is the default hash?
Any suggestions would be very much appreciated!
If I stumble across a better solution I will be sure to post it here - I loath threads without answers!
Thanks all!
The type I am placing into the list looks like this:
Code:
Structure MyType Dim FileName as String Dim FileDate as String Dim FileSize as String Dim NewPath as String End Structure Dim MyList as ListOf(MyType)
Code:
If MyList.Contains(sNewEntry) = False then MyList.Add(sNewEntry) End if
I *thought* it would be faster to try
Code:
If MyList.BinarySearch(sNewEntry) < 0 then MyList.Add(sNewEntry) End if
I also thought I might throw a hash into the structure and then force the CONTAINS or BINARYSEARCH method to only compare hashes - but I just can't figure out how to do that... Also - just how unique is the default hash?
Any suggestions would be very much appreciated!
If I stumble across a better solution I will be sure to post it here - I loath threads without answers!
Thanks all!
Comment