blob: cdfc1041c6b6573aa2ff0bd2ecd44fbcd0d5e16f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include <benchmark/benchmark.h>
#include <vector>
static void BM_vector_bool_copy_ctor(benchmark::State& state) {
std::vector<bool> vec(100, true);
for (auto _ : state) {
benchmark::DoNotOptimize(vec);
std::vector<bool> vec2(vec);
benchmark::DoNotOptimize(vec2);
}
}
BENCHMARK(BM_vector_bool_copy_ctor);
static void BM_vector_bool_size_ctor(benchmark::State& state) {
for (auto _ : state) {
std::vector<bool> vec(100, true);
benchmark::DoNotOptimize(vec);
}
}
BENCHMARK(BM_vector_bool_size_ctor);
BENCHMARK_MAIN();
|