about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
diff options
context:
space:
mode:
authorLukas Bergdoll <lukas.bergdoll@gmail.com>2024-08-25 19:14:00 +0200
committerLukas Bergdoll <lukas.bergdoll@gmail.com>2024-08-25 20:47:01 +0200
commit13d7b546dada1cb2960dec90875b16a42ff7fb84 (patch)
tree6be63771959b2fecf4326337b802ac09a7ea5566 /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
parentc8b14ba7b6777dfbfb64a02d7bbe867a54dddf2a (diff)
downloadrust-13d7b546dada1cb2960dec90875b16a42ff7fb84.tar.gz
rust-13d7b546dada1cb2960dec90875b16a42ff7fb84.zip
Add binary-size optimized variants for stable and unstable sort as well as select_nth_unstable
- Stable sort uses a simple merge-sort that re-uses the existing - rather gnarly - merge function.
- Unstable sort jumps directly to the branchless heapsort fallback.
- select_nth_unstable jumps directly to the median_of_medians fallback, which is augmented with a
  custom tiny smallsort and partition impl.

Some code is duplicated but de-duplication would bring it's own problems. For example `swap_if_less`
is critical for performance, if the sorting networks don't inline it perf drops drastically,
however `#[inline(always)]` is also a poor fit, if the provided comparison function is huge,
it gives the compiler an out to only instantiate `swap_if_less` once and call it. Another aspect
that would suffer when making `swap_if_less` pub, is having to cfg out dozens of functions in
in smallsort module.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
0 files changed, 0 insertions, 0 deletions