[libcxx-commits] [libcxx] [libcxx] Run std::pop_heap() benchmarks on heap-ordered inputs only (PR #182788)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Feb 22 17:15:32 PST 2026
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-libcxx
Author: Aleksei Sidorin (a-sid)
<details>
<summary>Changes</summary>
* std::pop_heap() Standard specification requires it to run on heap-ordered inputs only.
However, it looks like the current version runs it on randomly-ordered inputs,
which makes the benchmark results a bit questionable.
---
Full diff: https://github.com/llvm/llvm-project/pull/182788.diff
2 Files Affected:
- (modified) libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp (+4-2)
- (modified) libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp (+4-2)
``````````diff
diff --git a/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
index e4b96a0ae48c7..6b603589150e2 100644
--- a/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/pop_heap.bench.cpp
@@ -13,7 +13,7 @@
#include "common.h"
namespace {
-template <class ValueType>
+template <class ValueType, class Order>
struct PopHeap {
size_t Quantity;
@@ -25,6 +25,8 @@ struct PopHeap {
});
}
+ bool skip() const { return Order() != ::Order::Heap; }
+
std::string name() const { return "BM_PopHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
@@ -33,6 +35,6 @@ int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
if (benchmark::ReportUnrecognizedArguments(argc, argv))
return 1;
- makeCartesianProductBenchmark<PopHeap, AllValueTypes>(Quantities);
+ makeCartesianProductBenchmark<PopHeap, AllValueTypes, AllOrders>(Quantities);
benchmark::RunSpecifiedBenchmarks();
}
diff --git a/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp b/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
index ab3ae6f7c30ae..97d646c8a997a 100644
--- a/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
+++ b/libcxx/test/benchmarks/algorithms/ranges_pop_heap.bench.cpp
@@ -13,7 +13,7 @@
#include "common.h"
namespace {
-template <class ValueType>
+template <class ValueType, class Order>
struct RangesPopHeap {
size_t Quantity;
@@ -25,6 +25,8 @@ struct RangesPopHeap {
});
}
+ bool skip() const { return Order() != ::Order::Heap; }
+
std::string name() const { return "BM_RangesPopHeap" + ValueType::name() + "_" + std::to_string(Quantity); };
};
} // namespace
@@ -33,6 +35,6 @@ int main(int argc, char** argv) {
benchmark::Initialize(&argc, argv);
if (benchmark::ReportUnrecognizedArguments(argc, argv))
return 1;
- makeCartesianProductBenchmark<RangesPopHeap, AllValueTypes>(Quantities);
+ makeCartesianProductBenchmark<RangesPopHeap, AllValueTypes, AllOrders>(Quantities);
benchmark::RunSpecifiedBenchmarks();
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/182788
More information about the libcxx-commits
mailing list