I have sorted the archive and I have to sort it all the time.
I am currently using List.BinarySearch on my archive and then insert element at the right place. I've tried sorting the list after every entry, but display in unacceptable.
Is there a solution that will give better performance? Maybe I should use other collections.
(I know about the sortlist but it is limited to unique keys)
ordered type what is required for you. From the docs, insert , looking for an element, is done in all log (n) + m time , where in an tree The number of keys is, and current copies of the M elements are being handled.
However, the built in types for .NET 3.5, list. Binary search and inserting each object in the right place is a good start - but it internally uses an array, so when you insert, all copies of your display will be dropped due to .
If you can group your inserts in a batch that improves things, but until you can not just enter a sort operation after putting all of your own, by then you OrderedBag < / Code> to PowerCollections if you can.
Comments
Post a Comment