summaryrefslogtreecommitdiff
path: root/absl/container
diff options
context:
space:
mode:
authorGravatar Evan Brown <ezb@google.com>2023-01-20 10:32:12 -0800
committerGravatar Copybara-Service <copybara-worker@google.com>2023-01-20 10:33:02 -0800
commit52495da05f5d3b38c9127ae842cd5ef34ec90525 (patch)
tree3fb2c07418768bfab1a278a9e0e1624ed86c6e26 /absl/container
parenta0b102c35bae9dea68be21a718c8c7b459e239c8 (diff)
Add CodegenAbslRawHashSetStringFindNeEnd function, which is useful because the find isn't inlined but the iterator comparison is.
PiperOrigin-RevId: 503473637 Change-Id: I02b8d95b7a1b738314c4f07a863c7606f822f079
Diffstat (limited to 'absl/container')
-rw-r--r--absl/container/internal/raw_hash_set_benchmark.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/container/internal/raw_hash_set_benchmark.cc b/absl/container/internal/raw_hash_set_benchmark.cc
index 15deddcf..f77f2a7b 100644
--- a/absl/container/internal/raw_hash_set_benchmark.cc
+++ b/absl/container/internal/raw_hash_set_benchmark.cc
@@ -16,6 +16,7 @@
#include <cmath>
#include <numeric>
#include <random>
+#include <tuple>
#include <utility>
#include <vector>
@@ -512,6 +513,12 @@ bool CodegenAbslRawHashSetInt64FindNeEnd(
return table->find(key) != table->end();
}
+// This is useful because the find isn't inlined but the iterator comparison is.
+bool CodegenAbslRawHashSetStringFindNeEnd(
+ absl::container_internal::StringTable* table, const std::string& key) {
+ return table->find(key) != table->end();
+}
+
auto CodegenAbslRawHashSetInt64Insert(absl::container_internal::IntTable* table,
int64_t key)
-> decltype(table->insert(key)) {
@@ -531,6 +538,7 @@ void CodegenAbslRawHashSetInt64Iterate(
int odr =
(::benchmark::DoNotOptimize(std::make_tuple(
&CodegenAbslRawHashSetInt64Find, &CodegenAbslRawHashSetInt64FindNeEnd,
+ &CodegenAbslRawHashSetStringFindNeEnd,
&CodegenAbslRawHashSetInt64Insert, &CodegenAbslRawHashSetInt64Contains,
&CodegenAbslRawHashSetInt64Iterate)),
1);