3 ms·
I ported timsort to C#/dotnet recently. Available in this nuget: https://www.nuget.org/packages/Redzen/ https://www.nuget.org/packages/Redzen/ Source code her
by redcalx 8y ago
I ported timsort to C#/dotnet recently. Available in this nuget:
https://www.nuget.org/packages/Redzen/ https://www.nuget.org/packages/Redzen/
Source code here (there are three variants):
https://github.com/colgreen/Redzen/tree/master/Redzen/Sorting https://github.com/colgreen/Redzen/tree/master/Redzen/Sortin...
None of the standard framework sort methods perform a stable sort so it's handy for that, as well as being a lot faster for some data, i.e. with pre-sorted runs. Otherwise the framework now uses introsort which is pretty good, so you should definitely performance test with both. I use both sorts depending on the context and I usually end up using the built in introsort, with timsort used for a few special cases.