-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdimension.cpp
More file actions
39 lines (35 loc) · 795 Bytes
/
dimension.cpp
File metadata and controls
39 lines (35 loc) · 795 Bytes
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
32
33
34
35
36
37
38
39
#include <benchmark/benchmark.h>
#include <vector>
static void BM_ONE(benchmark::State &state)
{
std::vector<char> va(state.range(0) * 64);
for (auto _ : state)
{
for (auto &it : va)
{
benchmark::DoNotOptimize(it);
}
}
}
BENCHMARK(BM_ONE)->Range(1,1<<20);
static void BM_TWO(benchmark::State &state)
{
std::vector<std::vector<char>> vd(state.range(0), std::vector<char>(64));
for (auto _ : state)
{
for (auto &it : vd)
{
for (auto &id : it)
{
benchmark::DoNotOptimize(id);
}
}
}
}
BENCHMARK(BM_TWO)->Range(1,1<<20);;
int main(int argc, char **argv)
{
benchmark::Initialize(&argc, argv);
benchmark::RunSpecifiedBenchmarks();
return 0;
}