[libc++] "Bottom-up heapsort" improvement to sort_heap.
https://en.wikipedia.org/wiki/Heapsort#Bottom-up_heapsort In `pop_heap` specifically, the item we insert at the top and sift downward is guaranteed to be leaf-sized, so we expect it to go pretty far down. Sift it down as if it were INT_MIN, and then bubble it back up if needed. Also known as "heapsort with bounce." Numbers are here: https://godbolt.org/z/cvfnYW6fe Fixes #10008. Differential Revision: https://reviews.llvm.org/D118003
Loading
Please sign in to comment