os-rust/library/core
bors 363ae41883 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`
2024-09-24 18:48:08 +00:00
..
benches Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
src Auto merge of #129587 - Voultapher:opt-for-size-variants-of-sort-impls, r=cuviper 2024-09-24 18:48:08 +00:00
tests stabilize const_intrinsic_copy 2024-09-23 22:12:54 +02:00
Cargo.toml Port std library to RTEMS 2024-09-03 09:19:29 +02:00