Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / libcxx / benchmarks / algorithms / push_heap.bench.cpp
blobba96fa1469e604b73f9cb5579c29cd2acf98d0fd
1 //===----------------------------------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
9 #include <algorithm>
11 #include "common.h"
13 namespace {
14 template <class ValueType, class Order>
15 struct PushHeap {
16 size_t Quantity;
18 void run(benchmark::State& state) const {
19 runOpOnCopies<ValueType>(state, Quantity, Order(), BatchSize::CountElements, [](auto& Copy) {
20 for (auto I = Copy.begin(), E = Copy.end(); I != E; ++I) {
21 std::push_heap(Copy.begin(), I + 1);
23 });
26 bool skip() const { return Order() == ::Order::Heap; }
28 std::string name() const {
29 return "BM_PushHeap" + ValueType::name() + Order::name() + "_" + std::to_string(Quantity);
32 } // namespace
34 int main(int argc, char** argv) {
35 benchmark::Initialize(&argc, argv);
36 if (benchmark::ReportUnrecognizedArguments(argc, argv))
37 return 1;
38 makeCartesianProductBenchmark<PushHeap, AllValueTypes, AllOrders>(Quantities);
39 benchmark::RunSpecifiedBenchmarks();