aboutsummaryrefslogtreecommitdiff
path: root/absl/container/BUILD.bazel
diff options
context:
space:
mode:
authorEvan Brown <ezb@google.com>2024-03-19 12:07:34 -0700
committerCopybara-Service <copybara-worker@google.com>2024-03-19 12:08:27 -0700
commit1980d7b98a0cae64432ccf9c4afebda5e21b2c5e (patch)
tree89fa98715f94d4f0221080158e1c798dc5cf52c0 /absl/container/BUILD.bazel
parent43c36ffae6256b4c93c1b9d3c73efaf8c2c891ab (diff)
downloadabseil-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/BUILD.bazel')
-rw-r--r--absl/container/BUILD.bazel2
1 files changed, 2 insertions, 0 deletions
diff --git a/absl/container/BUILD.bazel b/absl/container/BUILD.bazel
index 0de45263..c1df8d83 100644
--- a/absl/container/BUILD.bazel
+++ b/absl/container/BUILD.bazel
@@ -701,8 +701,10 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:prefetch",
+ "//absl/functional:function_ref",
"//absl/hash",
"//absl/log",
+ "//absl/log:check",
"//absl/memory",
"//absl/meta:type_traits",
"//absl/strings",