Hacker News new | past | comments | ask | show | jobs | submit login
Smoothsort Demystified (2011) (keithschwarz.com)
97 points by csdrane on Jan 27, 2019 | hide | past | favorite | 3 comments



I was curious to see its performance. I found this page that benchmarks Keith's implementation with an implementation of std::sort and timsort.

In that test, it was thoroughly beaten in all benchmarks. The issue seems to be that it isn't cache friendly.

https://www.gamasutra.com/view/news/172542/Indepth_Smoothsor...


Awesome article. This is what I want to see in HN every day, very interesting and relatively unknown CS topic, well explained, easy to understand, well written code. Basically flawless. Unfortunately, HeapSort and its variants aren't that popular any more since they're not cache friendly. To see that, observe that in the article author maintains bunch of heaps in the array and even though it's asymptotically fast and in-place, you'll have to keep referring to distant parts of the array, causing cache misses.


As the author notes, Dijkstra's paper is a bit of a challenge, but it's well worth reading: https://www.cs.utexas.edu/users/EWD/transcriptions/EWD07xx/E.... It's a great example of deriving an algorithm from a predicated acceptance state.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: