aboutsummaryrefslogtreecommitdiffstats
path: root/benches/cheesemap_bench.cc
blob: 46960e13b4e9b87625f88515b9f298dec9900f7d (plain) (blame)
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <benchmark/benchmark.h>

#include "bench_common.h"

namespace {

using namespace cmbench;

static void BM_Insert_Scalar(benchmark::State& state) {
  bench_insert<CheesemapAdapter<std::uint64_t, ScalarValue>>(
      state, scalar_workload(), {"cheesemap", "c", "Scalar", "Insert"});
}
static void BM_LookupHit_Scalar(benchmark::State& state) {
  bench_lookup_hit<CheesemapAdapter<std::uint64_t, ScalarValue>>(
      state, scalar_workload(), {"cheesemap", "c", "Scalar", "LookupHit"});
}
static void BM_LookupMiss_Scalar(benchmark::State& state) {
  bench_lookup_miss<CheesemapAdapter<std::uint64_t, ScalarValue>>(
      state, scalar_workload(), {"cheesemap", "c", "Scalar", "LookupMiss"});
}
static void BM_Erase_Scalar(benchmark::State& state) {
  bench_erase<CheesemapAdapter<std::uint64_t, ScalarValue>>(
      state, scalar_workload(), {"cheesemap", "c", "Scalar", "Erase"});
}

static void BM_Insert_HandlePayload(benchmark::State& state) {
  bench_insert<CheesemapAdapter<EntityId, ComponentPayload>>(
      state, entity_workload(), {"cheesemap", "c", "HandlePayload", "Insert"});
}
static void BM_LookupHit_HandlePayload(benchmark::State& state) {
  bench_lookup_hit<CheesemapAdapter<EntityId, ComponentPayload>>(
      state, entity_workload(),
      {"cheesemap", "c", "HandlePayload", "LookupHit"});
}
static void BM_LookupMiss_HandlePayload(benchmark::State& state) {
  bench_lookup_miss<CheesemapAdapter<EntityId, ComponentPayload>>(
      state, entity_workload(),
      {"cheesemap", "c", "HandlePayload", "LookupMiss"});
}
static void BM_Erase_HandlePayload(benchmark::State& state) {
  bench_erase<CheesemapAdapter<EntityId, ComponentPayload>>(
      state, entity_workload(), {"cheesemap", "c", "HandlePayload", "Erase"});
}

static void BM_Insert_CompositeKey(benchmark::State& state) {
  bench_insert<CheesemapAdapter<ComponentKey, ComponentMeta>>(
      state, component_workload(),
      {"cheesemap", "c", "CompositeKey", "Insert"});
}
static void BM_LookupHit_CompositeKey(benchmark::State& state) {
  bench_lookup_hit<CheesemapAdapter<ComponentKey, ComponentMeta>>(
      state, component_workload(),
      {"cheesemap", "c", "CompositeKey", "LookupHit"});
}
static void BM_LookupMiss_CompositeKey(benchmark::State& state) {
  bench_lookup_miss<CheesemapAdapter<ComponentKey, ComponentMeta>>(
      state, component_workload(),
      {"cheesemap", "c", "CompositeKey", "LookupMiss"});
}
static void BM_Erase_CompositeKey(benchmark::State& state) {
  bench_erase<CheesemapAdapter<ComponentKey, ComponentMeta>>(
      state, component_workload(), {"cheesemap", "c", "CompositeKey", "Erase"});
}

}  // namespace

BENCHMARK(BM_Insert_Scalar);
BENCHMARK(BM_LookupHit_Scalar);
BENCHMARK(BM_LookupMiss_Scalar);
BENCHMARK(BM_Erase_Scalar);

BENCHMARK(BM_Insert_HandlePayload);
BENCHMARK(BM_LookupHit_HandlePayload);
BENCHMARK(BM_LookupMiss_HandlePayload);
BENCHMARK(BM_Erase_HandlePayload);

BENCHMARK(BM_Insert_CompositeKey);
BENCHMARK(BM_LookupHit_CompositeKey);
BENCHMARK(BM_LookupMiss_CompositeKey);
BENCHMARK(BM_Erase_CompositeKey);