summaryrefslogtreecommitdiff
path: root/absl/container/internal/raw_hash_set_benchmark.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/container/internal/raw_hash_set_benchmark.cc')
-rw-r--r--absl/container/internal/raw_hash_set_benchmark.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/absl/container/internal/raw_hash_set_benchmark.cc b/absl/container/internal/raw_hash_set_benchmark.cc
index a3647890..a9b52c4f 100644
--- a/absl/container/internal/raw_hash_set_benchmark.cc
+++ b/absl/container/internal/raw_hash_set_benchmark.cc
@@ -14,6 +14,8 @@
#include <array>
#include <cmath>
+#include <cstddef>
+#include <cstdint>
#include <numeric>
#include <random>
#include <tuple>
@@ -205,6 +207,22 @@ void CacheInSteadyStateArgs(Benchmark* bm) {
}
BENCHMARK(BM_CacheInSteadyState)->Apply(CacheInSteadyStateArgs);
+void BM_EraseEmplace(benchmark::State& state) {
+ IntTable t;
+ int64_t size = state.range(0);
+ for (int64_t i = 0; i < size; ++i) {
+ t.emplace(i);
+ }
+ while (state.KeepRunningBatch(size)) {
+ for (int64_t i = 0; i < size; ++i) {
+ benchmark::DoNotOptimize(t);
+ t.erase(i);
+ t.emplace(i);
+ }
+ }
+}
+BENCHMARK(BM_EraseEmplace)->Arg(1)->Arg(2)->Arg(4)->Arg(8)->Arg(16)->Arg(100);
+
void BM_EndComparison(benchmark::State& state) {
StringTable t = {{"a", "a"}, {"b", "b"}};
auto it = t.begin();