Expand description
SIMD-accelerated radix sort for primitive types.
turbosort provides O(n) LSD radix sort with SIMD acceleration for the 10
primitive numeric types: u8, u16, u32, u64, i8, i16, i32,
i64, f32, f64.
§Features
std(default): enables heap allocation for internal buffers.alloc: likestdbut forno_std+ allocator environments.parallel: enablessort_parallel()via rayon for huge arrays.
§Usage
let mut data = vec![5u32, 3, 8, 1, 9, 2, 7, 4, 6];
turbosort::sort(&mut data);
assert_eq!(data, vec![1, 2, 3, 4, 5, 6, 7, 8, 9]);For allocation-sensitive code, use sort_with_buffer:
let mut data = [5u32, 3, 8, 1, 9];
let mut buf = [0u32; 5];
turbosort::sort_with_buffer(&mut data, &mut buf);
assert_eq!(data, [1, 3, 5, 8, 9]);Re-exports§
pub use key::SortableKey;
Modules§
- key
- Traits for mapping primitive types to their unsigned radix-sortable keys.
Functions§
- sort
- Sort a mutable slice of any
SortableKeytype in ascending order. - sort_
with_ buffer - Sort a mutable slice using a caller-provided buffer.