[all-commits] [llvm/llvm-project] e3d375: [libc++] Complexity regression tests for make_heap...

Quuxplusone via All-commits all-commits at lists.llvm.org
Tue Mar 8 10:48:54 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: e3d3755c4745aee33b55ad4e5ab72c46e4133a8e
      https://github.com/llvm/llvm-project/commit/e3d3755c4745aee33b55ad4e5ab72c46e4133a8e
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    A libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/make.heap/complexity.pass.cpp
    A libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp

  Log Message:
  -----------
  [libc++] Complexity regression tests for make_heap and sort_heap.

Reviewed as part of D118003.


  Commit: 79d08e398c17e83b118b837ab0b52107fd294c3e
      https://github.com/llvm/llvm-project/commit/79d08e398c17e83b118b837ab0b52107fd294c3e
  Author: Arthur O'Dwyer <arthur.j.odwyer at gmail.com>
  Date:   2022-03-08 (Tue, 08 Mar 2022)

  Changed paths:
    M libcxx/docs/ReleaseNotes.rst
    M libcxx/include/__algorithm/pop_heap.h
    M libcxx/include/__algorithm/sift_down.h
    M libcxx/test/libcxx/algorithms/alg.sorting/alg.heap.operations/sort.heap/complexity.pass.cpp

  Log Message:
  -----------
  [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


Compare: https://github.com/llvm/llvm-project/compare/687e4af1c05a...79d08e398c17


More information about the All-commits mailing list