I'm going through a List<>
, performing some operations on each item, and then depending on the outcome of those operations, potentially adding each one to another data structure, for which I'm currently using a SortedSet<>
. After this, I want the top-sorted n
items as a list.
The only other thing I ever have to do to this SortedSet<>
is clear the whole thing and start anew. Is there any way I can milk a little more performance out of this?
I saw this similar question where the poster was able to achieve about a 1/6 reduction in run time using a custom red-black tree (after their question was answered). But isn't the SortedSet<> a red-black tree already? Is it worth it for me to try and bank some performance increase through creating my own data structure in this case?