diff options
author | Evan Brown <ezb@google.com> | 2024-03-19 12:07:34 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2024-03-19 12:08:27 -0700 |
commit | 1980d7b98a0cae64432ccf9c4afebda5e21b2c5e (patch) | |
tree | 89fa98715f94d4f0221080158e1c798dc5cf52c0 /absl/container/CMakeLists.txt | |
parent | 43c36ffae6256b4c93c1b9d3c73efaf8c2c891ab (diff) | |
download | abseil-1980d7b98a0cae64432ccf9c4afebda5e21b2c5e.tar.gz abseil-1980d7b98a0cae64432ccf9c4afebda5e21b2c5e.tar.bz2 abseil-1980d7b98a0cae64432ccf9c4afebda5e21b2c5e.zip |
Do hashtablez sampling on the first insertion into an empty SOO hashtable.
When sampling triggers, we skip SOO and allocate a backing array. We must do this because the HashtablezInfoHandle is part of the heap allocation (along with the control bytes and slots). By default, we sample 1 in ~1024 hashtables when sampling is enabled. This will impact performance because (a) we won't benefit from SOO so we would have worse data locality (more cache/TLB misses), and (b) the backing array capacity will be 3 instead of 1 so (b.1) we skip the rehash after the second insertion and (b.2) we potentially waste up to two slots worth of memory.
We also add an soo_capacity field to HashtablezInfo to allow for distinguishing which sampled tables may otherwise have been SOO - this will allow us to know approximately what fraction of tables are in SOO mode.
PiperOrigin-RevId: 617252334
Change-Id: Ib48b7a4870bd74ea3ba923ed8f350a3b75dbb7d3
Diffstat (limited to 'absl/container/CMakeLists.txt')
-rw-r--r-- | absl/container/CMakeLists.txt | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt index 4b08e6a3..7fa2e914 100644 --- a/absl/container/CMakeLists.txt +++ b/absl/container/CMakeLists.txt @@ -753,11 +753,13 @@ absl_cc_test( ${ABSL_TEST_COPTS} DEPS absl::base + absl::check absl::config absl::container_memory absl::core_headers absl::flat_hash_map absl::flat_hash_set + absl::function_ref absl::hash absl::hash_function_defaults absl::hash_policy_testing |