I improved the code but more importantly made sure the right sorter gets called, look at their source
here, line 00844.
Notice that they would try to use non-.NET SZsort first, if it fails or some conditions set then they will try SorterObjectArray - this is much slower, but still okay, but they may also fall to the slowest piece of sh1t of a code SorterGenericArray: in profiler I could see that they were falling to it without good reason. So I took SorterObjectArray code and made sure it works with explicit types to allow compiler made optimisations, unlike ******** Microsoft programmers I am not lazy to copy paste same code with small changes to mak esure its optimised to the max. Say look at their code checking for presense of items:
if (items != null)
{ // do stuff
}
They do it in one tight loop, ffs, you can check it ONCE before calling that code and decide to call correct path to avoid making comparison that will yield same result all the time, ffs, sometimes copy/paste/lil-change approach is the best way to max performance.
FFS, and look at SorterObjectArray - because they forced Array.Sort to deal with arrays type of object[] it means they had to use Comparer, thus calling Int32 comparer on object rather than creating dozen copies of Array.Sort to deal with
ALL primitive type combinations. FFS, this is obvious and certainly no excuse not to do in the base library that must be ultra fast!!!
It pissed me off big time that they were calling the slowest sorter of them all when I tried to sort int[],int[] arrays ffs, the difference is so big that its criminal to not spend 1 days making sure sorting is lighting fast - the base library code is not written for show of how one big superfunction can do it all ffs.