Following latest fixes in std::inplace_merge and std::stable_sort you propose Jonathan to enhance branching in the first. Here is a proposal based on yours to do so in both algos.     libstdc++: Enhance branching in std::inplace_merge and std::stable_sort     libstdc++-v3/ChangeLog:             * include/bits/stl_algo.h             (__merge_adaptive): Adapt to merge only when buffer is large enough..             (__merge_adaptive_resize): New, adapt merge when buffer is too small.             (__inplace_merge): Adapt, use latter.             (__stable_sort_adaptive): Adapt to sort only when buffer is large enough.             (__stable_sort_adaptive_resize): New, adapt sort when buffer is too small.             (__stable_sort): Adapt, use latter. Tested under Linux x64. Ok to commit ? François