32 lines · cpp
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-exception6//7//===----------------------------------------------------------------------===//8 9#include <benchmark/benchmark.h>10#include <vector>11 12static void BM_vector_bool_copy_ctor(benchmark::State& state) {13 std::vector<bool> vec(100, true);14 15 for (auto _ : state) {16 benchmark::DoNotOptimize(vec);17 std::vector<bool> vec2(vec);18 benchmark::DoNotOptimize(vec2);19 }20}21BENCHMARK(BM_vector_bool_copy_ctor);22 23static void BM_vector_bool_size_ctor(benchmark::State& state) {24 for (auto _ : state) {25 std::vector<bool> vec(100, true);26 benchmark::DoNotOptimize(vec);27 }28}29BENCHMARK(BM_vector_bool_size_ctor);30 31BENCHMARK_MAIN();32