AsproSort Links
Download source code:

AsproSort - High Performance Sorting for .Net

Many developers think that sorting is a "solved" problem. "You should never want to code your own sorting routine. Just use your library sort routine. I haven't coded up a sorting algorithm since I left college." These are a few of the usual responses to the idea of anyone writing an alternative to the standard library (or framework) sorting routines. So why would Asprosys put together a library of simple sort routines for .Net?

The sorting routines included with the .Net Framework libraries are Quicksort routines that are for the most part the most efficient general purpose sorting available. For most applications the amount of data sorted is small enough that innefficiencies inherent in using a non-optimised sort are immaterial and using the builtin methods is more than adequate. But for a significant minority of applications the speed up of using a more optimised solution or an algorithm more appropriate to the data can be essential.

The builtin .Net sorting routines are "safe", single threaded and slow. By using unsafe, type specific and parallelized code Asprosort Quicksort can outperform the .Net variant by between 10% and 70% for single to quad processor architectures. Mergesort can provide a stable sort at much higher speeds than using the builtin methods with complicated custom comparers. And some data shapes (such as data that is already almost entirely sorted) can be handled in ways just not available without alternative sorting algorithms.

AsproSort provides superior sorting solutions to most of the applications that need alternatives to the builtin .Net routines. But for a small minority that isn't even enough, these solutions need custom sorts specific to their data type. Here again Asprosort comes through, the included code is easily modified to create custom sort routines that can massively outperform all comers.

Check out some numbers on AsproSort here .
For the next release of AsproSort the plan is to move Heapsort from a binary Heapsort to a ternary Heapsort, this should improve sort times by about 10%. We'll be adding a Samplesort as an alternative to the somewhat naive parallelization of Quicksort. Also, we'll likely be adding one or more of Flashsort, Timsort and In-place Mergesort. In the meantime we are always open to suggestions so if you have a feature request post it on the AsproTools Discussion Board.