
Performance
Sorting in Rust Stable Versus Unstable and Their Costs
sort is stable and allocates, sort_unstable does not and is usually faster. Learn when stability matters, sort_by_key pitfalls and the cached-key variant for expensive keys.
3 min read