Hacker News new | ask | show | jobs
by mastax 3281 days ago
https://github.com/rust-lang/rust/pull/40601

"stable" is a simplified Timsort: https://github.com/rust-lang/rust/pull/38192

"unstable" is a pdqsort

1 comments

To summarize:

If comparison is cheap (e.g. when sorting integers), pdqsort wins because it copies less data around and the instructions are less data-dependency-heavy.

If comparison is expensive (e.g. when sorting strings), timsort is usually a tiny bit faster (around 5% or less) because it performs a slightly smaller total number of comparisons.