diff options
author | Abseil Team <absl-team@google.com> | 2024-02-15 23:54:17 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-02-15 23:55:05 -0800 |
commit | 8a3caf7dea955b513a6c1b572a2423c6b4213402 (patch) | |
tree | de68093898cdea318859c9e37dcb7eaf20c700b2 /absl/container/internal/raw_hash_set_benchmark.cc | |
parent | 4580d86d07dbd7614aaedce0b519752334245db6 (diff) | |
download | abseil-8a3caf7dea955b513a6c1b572a2423c6b4213402.tar.gz abseil-8a3caf7dea955b513a6c1b572a2423c6b4213402.tar.bz2 abseil-8a3caf7dea955b513a6c1b572a2423c6b4213402.zip |
Introduce `Group::MaskNonFull` without usage.
It can be used instead of `MaskEmptyOrDeleted` in case of inserting to empty table.
`MaskNonFull` requires less operations, in particular it eliminates `_mm_set1_epi8` and `_mm_cmpgt_epi8` operations.
PiperOrigin-RevId: 607587394
Change-Id: Ia48f922d1ca6de38cc91e7ab0d608c45f8f2c446
Diffstat (limited to 'absl/container/internal/raw_hash_set_benchmark.cc')
-rw-r--r-- | absl/container/internal/raw_hash_set_benchmark.cc | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/absl/container/internal/raw_hash_set_benchmark.cc b/absl/container/internal/raw_hash_set_benchmark.cc index bc8184d4..8cd43fb5 100644 --- a/absl/container/internal/raw_hash_set_benchmark.cc +++ b/absl/container/internal/raw_hash_set_benchmark.cc @@ -479,6 +479,17 @@ void BM_Group_MaskEmptyOrDeleted(benchmark::State& state) { } BENCHMARK(BM_Group_MaskEmptyOrDeleted); +void BM_Group_MaskNonFull(benchmark::State& state) { + std::array<ctrl_t, Group::kWidth> group; + Iota(group.begin(), group.end(), -4); + Group g{group.data()}; + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MaskNonFull()); + } +} +BENCHMARK(BM_Group_MaskNonFull); + void BM_Group_CountLeadingEmptyOrDeleted(benchmark::State& state) { std::array<ctrl_t, Group::kWidth> group; Iota(group.begin(), group.end(), -2); @@ -501,6 +512,17 @@ void BM_Group_MatchFirstEmptyOrDeleted(benchmark::State& state) { } BENCHMARK(BM_Group_MatchFirstEmptyOrDeleted); +void BM_Group_MatchFirstNonFull(benchmark::State& state) { + std::array<ctrl_t, Group::kWidth> group; + Iota(group.begin(), group.end(), -2); + Group g{group.data()}; + for (auto _ : state) { + ::benchmark::DoNotOptimize(g); + ::benchmark::DoNotOptimize(g.MaskNonFull().LowestBitSet()); + } +} +BENCHMARK(BM_Group_MatchFirstNonFull); + void BM_DropDeletes(benchmark::State& state) { constexpr size_t capacity = (1 << 20) - 1; std::vector<ctrl_t> ctrl(capacity + 1 + Group::kWidth); |