| Crates.io | vqsort-rs |
| lib.rs | vqsort-rs |
| version | 0.3.0 |
| created_at | 2024-05-21 19:50:19.436526+00 |
| updated_at | 2025-06-01 12:48:20.296494+00 |
| description | Rust bindings for Google's Highway vectorized quicksort |
| homepage | |
| repository | https://github.com/lincot/vqsort-rs |
| max_upload_size | |
| id | 1247161 |
| size | 35,612 |
Rust bindings for Google's Highway vectorized quicksort.
The vectorized quicksort sorting algorithm is very fast, as demonstrated in a
writeup,
and outperforms the standard Rust sort_unstable. However, it only supports
primitive integer and floating-point types, as well as key-value tuples.
Supported types:
i16, u16i32, u32i64, u64isize, usizeu128f32, f64Key64Value64, Key32Value32let mut data = [5, 3, 8, 0, -100];
vqsort_rs::sort(&mut data);
assert_eq!(data, [-100, 0, 3, 5, 8]);
vqsort_rs::sort_descending(&mut data);
assert_eq!(data, [8, 5, 3, 0, -100]);
use vqsort_rs::Key32Value32; // or Key64Value64
let mut data = [
Key32Value32 { value: 0, key: 5 },
Key32Value32 { value: 1, key: 3 },
Key32Value32 { value: 2, key: 8 },
Key32Value32 { value: 3, key: 0 },
];
vqsort_rs::sort(&mut data);
assert_eq!(
data,
[
Key32Value32 { value: 3, key: 0 },
Key32Value32 { value: 1, key: 3 },
Key32Value32 { value: 0, key: 5 },
Key32Value32 { value: 2, key: 8 },
]
);
vqsort_rs::sort_descending(&mut data);
assert_eq!(
data,
[
Key32Value32 { value: 2, key: 8 },
Key32Value32 { value: 0, key: 5 },
Key32Value32 { value: 1, key: 3 },
Key32Value32 { value: 3, key: 0 },
]
);
When testing under Miri, this crate falls back to sort_unstable because Miri
does not support FFI.