S
Stuart
Hi everyone,
I have this app that needs to insert about 400,000+ items into a sorted
list, and I am currently using a simple insert something like this:
int index = list.BinarySearch(t);
if (index < 0)
list.Insert(~index, t);
But this gets increasingly slow, it takes 1ms to insert the first 1,000,
20ms to do the thousand between 19,000 and 20,000 and 400ms per thousand
when over 200,000. The slowdown is on the insert, the binarysearch is still
lightning quick.
Does anyong know a better way to do this? using List or otherwise. I
expected slowdown but this is quite harsh.
Thanks
Stuart
I have this app that needs to insert about 400,000+ items into a sorted
list, and I am currently using a simple insert something like this:
int index = list.BinarySearch(t);
if (index < 0)
list.Insert(~index, t);
But this gets increasingly slow, it takes 1ms to insert the first 1,000,
20ms to do the thousand between 19,000 and 20,000 and 400ms per thousand
when over 200,000. The slowdown is on the insert, the binarysearch is still
lightning quick.
Does anyong know a better way to do this? using List or otherwise. I
expected slowdown but this is quite harsh.
Thanks
Stuart