On Sun, 16 Jul 2017, Segher Boessenkool wrote: > > How? There's no stable sort in libc and switching over to std::stable_sort > > would be problematic. > > Why?
- you'd need to decide if the build time cost of extra 8000+ lines lines brought in by <algorithm> (per each TU) is acceptable; - you'd need to decide if the code size cost of multiple instantiations of template stable_sort is acceptable (or take measures to unify them); - you'd need to adapt comparators, as STL uses a different interface that C qsort; - you'd need to ensure it doesn't lead to a noticeable slowdown. (unrelated, but calls to std::stable sort cannot be intercepted by Yuri's sortcheck, and of course my recent sortcheck-like patch entirely missed it too) > Sure. Some of our sorts in fact require stable sort though At moment only bb-reorder appears to use std::stable_sort, is that what you meant, or are there more places? Alexander