5 ms·
Do you happen to have a link for benchmark ? i would like to learn what i miss happening in rust. Last time i read about sort implementations here on HN [0]
by SleepyMyroslav 2y ago
Do you happen to have a link for benchmark ?
i would like to learn what i miss happening in rust. Last time
i read about sort implementations here on HN [0] rust panic safety had some measurable costs: 0. https://news.ycombinator.com/item?id=34646199 https://news.ycombinator.com/item?id=34646199
- IshKebab 2y agoTake a look at these results: https://youtu.be/rZ7QQWKP8Rk?t=2054 https://youtu.be/rZ7QQWKP8Rk?t=2054 Watch until the next slide - it shows a comparison of a port of a very fast C++ sorting algorithm to Rust. Rust is faster due to algorithmic changes. Ignoring those they are very similar speeds; certainly not an issue.
- SleepyMyroslav 2y agoNon video version is there [0]. My take on it is that there are no 'language comparisons' there. Difference is between older and newer algorithms and benchmark favorite is written in C. Its cool that new algorithms are implemented in new-ish language first. [0] https://github.com/Voultapher/sort-research-rs/blob/main/writeup/sort_safety/text.md#performance https://github.com/Voultapher/sort-research-rs/blob/main/wri...
- IshKebab 2y agoThat version is 2 years old. Rust has had a new faster sort implementation since then. > My take on it is that there are no 'language comparisons' there. Watch the video a few minutes forwards from when I linked, there are "language comparison" slides. Basically C++ and Rust are on par.
- SleepyMyroslav 2y agoThanks! Updated results are interesting.
- tialaramex 2y agoAh, now I think I see the misunderstanding. When I said "equivalents" I mean that these are the standard library sorts, and so I was comparing against the standard library sorts in the three popular C++ implementations. You're correct that if you implemented these algorithms carefully in C++ you can expect very similar results. I don't believe that anybody has done that and certainly there is no sign the three major implementations would attempt to switch to these algorithms for their standard library sorts. In Rust today the standard library sorts provided are further refinements of the "ipnsort" and "glidesort" algorithms described in the paper you linked. As the papers arguing to use these algorithms point out, the downside is that although they've been tested extensively with available tools we can't actually prove they're even safe, the upside is of course performance.