I have a use case where I have to sort int32 slices repeatedly that are 
already partially sorted.  (Imagine a tree of smaller non-overlapping 
segments of the same slice, where sorting starts at the bottom and moves to 
the top and the results of the individual sorts are required for the 
algorithm.) Speed is critical for the use case. The StableSort method is an 
excellent first approach for it, because it uses the SymMerge algorithm and 
for small blocks InsertionSort benefiting from pre-sorted runs. Small 
performance improvements benefit the use case, so I looked at 
golang.org/x/exp/slices which contains a SortStableFunc but not a pure 
SortStable method, which I would like to use because I need only the order 
implied by the default less-than (<) operator. For non-stable sorting there 
is pure Sort function, so I wonder why SortStable has been left out. Has it 
not been added because of the NAN issue? 

For now I can live with SortStableFunc since I plan a custom sort using the 
knowledge of the positions of the sorted sub-segments,  but I'm puzzled 
about the lack of a pure SortStable.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/89ad151a-a604-45d5-a6a4-620c0024060an%40googlegroups.com.

Reply via email to