summary refs log tree commit diff
path: root/compiler/rustc_codegen_llvm/src/builder.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-24 18:48:08 +0000
committerbors <bors@rust-lang.org>2024-09-24 18:48:08 +0000
commit363ae4188316b8b22cf6c1890bc73d84d05f70a4 (patch)
tree58b75b9988422548df0f034a2f975f9513ec1ab6 /compiler/rustc_codegen_llvm/src/builder.rs
parent67bb749c2e1cf503fee64842963dd3e72a417a3f (diff)
parent54391983486d5271c378821c8e6a8f018dfdd14d (diff)
downloadrust-363ae4188316b8b22cf6c1890bc73d84d05f70a4.tar.gz
rust-363ae4188316b8b22cf6c1890bc73d84d05f70a4.zip
Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impls, r=cuviper
Add `optimize_for_size` 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.

Part of https://github.com/rust-lang/rust/issues/125612

r​? `@Kobzol`
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/builder.rs')
0 files changed, 0 insertions, 0 deletions