Export of internal Abseil changes
-- 3e6352709da9a529e608eabff862a12bfaecb587 by Gennadiy Rozental <rogeeff@google.com>: Replace local copy of FastTypeId with one shared in absl/base/internal. PiperOrigin-RevId: 304181357 -- c89ea428f732226f4dceb508cd6ba3955a1e49e1 by Andy Getzendanner <durandal@google.com>: Typo fix: add a missing colon. PiperOrigin-RevId: 304064210 -- de2ee7a96bdc7193ffcceb6a2fd6bf464955cbe7 by Samuel Benzaquen <sbenza@google.com>: Reduce the overhead of the registration token by using an empty struct instead of bool. PiperOrigin-RevId: 304054311 -- 222f05d24fb1df7e815946543a7dc78847c83f92 by Derek Mauro <dmauro@google.com>: Turn off hashtablez in opensource builds. Hashtablez is an unsupported, internal-only feature for collecting information about hashtable usage and performance. By turning it off in builds where it is unsupported, we get just a little more performance. PiperOrigin-RevId: 304035460 GitOrigin-RevId: 3e6352709da9a529e608eabff862a12bfaecb587 Change-Id: I0bfe9b5df808a7e35c154b39e6c80e68b0da2b70
This commit is contained in:
parent
fba8a316c3
commit
62f05b1f57
11 changed files with 47 additions and 35 deletions
|
@ -257,6 +257,7 @@ cc_test(
|
|||
":unordered_map_lookup_test",
|
||||
":unordered_map_members_test",
|
||||
":unordered_map_modifiers_test",
|
||||
"//absl/base:raw_logging_internal",
|
||||
"//absl/types:any",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
],
|
||||
|
@ -290,6 +291,7 @@ cc_test(
|
|||
":unordered_set_lookup_test",
|
||||
":unordered_set_members_test",
|
||||
":unordered_set_modifiers_test",
|
||||
"//absl/base:raw_logging_internal",
|
||||
"//absl/memory",
|
||||
"//absl/strings",
|
||||
"@com_google_googletest//:gtest_main",
|
||||
|
|
|
@ -303,6 +303,7 @@ absl_cc_test(
|
|||
absl::unordered_map_members_test
|
||||
absl::unordered_map_modifiers_test
|
||||
absl::any
|
||||
absl::raw_logging_internal
|
||||
gmock_main
|
||||
)
|
||||
|
||||
|
@ -339,6 +340,7 @@ absl_cc_test(
|
|||
absl::unordered_set_members_test
|
||||
absl::unordered_set_modifiers_test
|
||||
absl::memory
|
||||
absl::raw_logging_internal
|
||||
absl::strings
|
||||
gmock_main
|
||||
)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <memory>
|
||||
|
||||
#include "absl/base/internal/raw_logging.h"
|
||||
#include "absl/container/internal/hash_generator_testing.h"
|
||||
#include "absl/container/internal/unordered_map_constructor_test.h"
|
||||
#include "absl/container/internal/unordered_map_lookup_test.h"
|
||||
|
@ -34,6 +35,19 @@ using ::testing::IsEmpty;
|
|||
using ::testing::Pair;
|
||||
using ::testing::UnorderedElementsAre;
|
||||
|
||||
// Check that absl::flat_hash_map works in a global constructor.
|
||||
struct BeforeMain {
|
||||
BeforeMain() {
|
||||
absl::flat_hash_map<int, int> x;
|
||||
x.insert({1, 1});
|
||||
ABSL_RAW_CHECK(x.find(0) == x.end(), "x should not contain 0");
|
||||
auto it = x.find(1);
|
||||
ABSL_RAW_CHECK(it != x.end(), "x should contain 1");
|
||||
ABSL_RAW_CHECK(it->second, "1 should map to 1");
|
||||
}
|
||||
};
|
||||
const BeforeMain before_main;
|
||||
|
||||
template <class K, class V>
|
||||
using Map = flat_hash_map<K, V, StatefulTestingHash, StatefulTestingEqual,
|
||||
Alloc<std::pair<const K, V>>>;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include "absl/base/internal/raw_logging.h"
|
||||
#include "absl/container/internal/hash_generator_testing.h"
|
||||
#include "absl/container/internal/unordered_set_constructor_test.h"
|
||||
#include "absl/container/internal/unordered_set_lookup_test.h"
|
||||
|
@ -36,6 +37,17 @@ using ::testing::Pointee;
|
|||
using ::testing::UnorderedElementsAre;
|
||||
using ::testing::UnorderedElementsAreArray;
|
||||
|
||||
// Check that absl::flat_hash_set works in a global constructor.
|
||||
struct BeforeMain {
|
||||
BeforeMain() {
|
||||
absl::flat_hash_set<int> x;
|
||||
x.insert(1);
|
||||
ABSL_RAW_CHECK(!x.contains(0), "x should not contain 0");
|
||||
ABSL_RAW_CHECK(x.contains(1), "x should contain 1");
|
||||
}
|
||||
};
|
||||
const BeforeMain before_main;
|
||||
|
||||
template <class T>
|
||||
using Set =
|
||||
absl::flat_hash_set<T, StatefulTestingHash, StatefulTestingEqual, Alloc<T>>;
|
||||
|
|
|
@ -184,11 +184,6 @@ class HashtablezInfoHandle {
|
|||
#error ABSL_INTERNAL_HASHTABLEZ_SAMPLE cannot be directly set
|
||||
#endif // defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
|
||||
|
||||
#if (ABSL_PER_THREAD_TLS == 1) && !defined(ABSL_BUILD_DLL) && \
|
||||
!defined(ABSL_CONSUME_DLL)
|
||||
#define ABSL_INTERNAL_HASHTABLEZ_SAMPLE
|
||||
#endif
|
||||
|
||||
#if defined(ABSL_INTERNAL_HASHTABLEZ_SAMPLE)
|
||||
extern ABSL_PER_THREAD_TLS_KEYWORD int64_t global_next_sample;
|
||||
#endif // ABSL_PER_THREAD_TLS
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue