I am currently working on a project where I have to manage large sets of unique elements. Each element has ~ 20 properties, and each element has a public DateTime property.
The DateTime property is not unique, so I cannot use a shared dictionary to store my data.
I am currently placing these items in an ObservableCollection, but the performance of deleting items from the collection is incredibly slow, I end up expecting ~ 20 seconds to remove ~ 7000 items from the collection of ~ 25,000 items.
(The search operation seems quite effective; it takes only ~ 30 ms to search 80 randomly selected items from an unsorted collection of 300,000 items).
Each element implements the GetHashCode () method, simply returning DateTime.GetHashCode ().
I thought using a HashSet, rather than an ObservableCollection, would increase my performance quite a bit, but this seems to have no effect ...
And using a generic dictionary is even worse ...
Is a HashSet more powerful than an ObservableCollection if the elements have "good" hash functions (very few elements that have the same hash code)?
source
share