pub fn sort_by<F>(&mut self, mut compare: F)
    where
        F: FnMut(&T, &T) -> Ordering,
    {
        merge_sort(self, |a, b| compare(a, b) == Less);
    }
Sorts the slice with a key extraction function.

During sorting, the key function is called only once per element.

This sort is stable (i.e., does not reorder equal elements) and *O*(*m* \* *n* + *n* \* log(*n*))
worst-case, where the key function is *O*(*m*).

For simple key functions (e.g., functions that are property accesses or
basic operations), [`sort_by_key`](slice::sort_by_key) is likely to be
faster.

# Current implementation

The current algorithm is based on [pattern-defeating quicksort][pdqsort] by Orson Peters,
which combines the fast average case of randomized quicksort with the fast worst case of
heapsort, while achieving linear time on slices with certain patterns. It uses some
randomization to avoid degenerate cases, but with a fixed seed to always provide
deterministic behavior.

In the worst c
benchmarks/haystacks/code/rust-library.rs