Commit 52495da0 by Evan Brown Committed by Copybara-Service

Add CodegenAbslRawHashSetStringFindNeEnd function, which is useful because the…

Add CodegenAbslRawHashSetStringFindNeEnd function, which is useful because the find isn't inlined but the iterator comparison is.

PiperOrigin-RevId: 503473637
Change-Id: I02b8d95b7a1b738314c4f07a863c7606f822f079
parent a0b102c3
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <cmath> #include <cmath>
#include <numeric> #include <numeric>
#include <random> #include <random>
#include <tuple>
#include <utility> #include <utility>
#include <vector> #include <vector>
...@@ -512,6 +513,12 @@ bool CodegenAbslRawHashSetInt64FindNeEnd( ...@@ -512,6 +513,12 @@ bool CodegenAbslRawHashSetInt64FindNeEnd(
return table->find(key) != table->end(); 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, auto CodegenAbslRawHashSetInt64Insert(absl::container_internal::IntTable* table,
int64_t key) int64_t key)
-> decltype(table->insert(key)) { -> decltype(table->insert(key)) {
...@@ -531,6 +538,7 @@ void CodegenAbslRawHashSetInt64Iterate( ...@@ -531,6 +538,7 @@ void CodegenAbslRawHashSetInt64Iterate(
int odr = int odr =
(::benchmark::DoNotOptimize(std::make_tuple( (::benchmark::DoNotOptimize(std::make_tuple(
&CodegenAbslRawHashSetInt64Find, &CodegenAbslRawHashSetInt64FindNeEnd, &CodegenAbslRawHashSetInt64Find, &CodegenAbslRawHashSetInt64FindNeEnd,
&CodegenAbslRawHashSetStringFindNeEnd,
&CodegenAbslRawHashSetInt64Insert, &CodegenAbslRawHashSetInt64Contains, &CodegenAbslRawHashSetInt64Insert, &CodegenAbslRawHashSetInt64Contains,
&CodegenAbslRawHashSetInt64Iterate)), &CodegenAbslRawHashSetInt64Iterate)),
1); 1);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment