diff options
author | Evan Brown <ezb@google.com> | 2023-08-03 09:24:57 -0700 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2023-08-03 09:26:23 -0700 |
commit | 14a91eefa7a3f3bf0a949e82ce5854659588a5c0 (patch) | |
tree | e5bb5049e1d8f411c19d665d5e14c7dd82974c59 /absl/container/internal/raw_hash_set.h | |
parent | d2de53124ec55390ce1ec66fd1fbf28b5a7ec4ec (diff) |
Update the comment for capacity_ to mention recent experiments to compress the field and store it together with size_.
PiperOrigin-RevId: 553499768
Change-Id: Ia6eec6d580475a2b76a2415bfb35bcc08131ae34
Diffstat (limited to 'absl/container/internal/raw_hash_set.h')
-rw-r--r-- | absl/container/internal/raw_hash_set.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/absl/container/internal/raw_hash_set.h b/absl/container/internal/raw_hash_set.h index 5f89d8ef..26cd2e54 100644 --- a/absl/container/internal/raw_hash_set.h +++ b/absl/container/internal/raw_hash_set.h @@ -1027,9 +1027,8 @@ class CommonFields : public CommonFieldsGenerationInfo { } private: - // TODO(b/259599413): Investigate removing some of these fields: + // TODO(b/182800944): Investigate removing some of these fields: // - control/slots can be derived from each other - // - we can use 6 bits for capacity since it's always a power of two minus 1 // The control bytes (and, also, a pointer near to the base of the backing // array). @@ -1044,6 +1043,12 @@ class CommonFields : public CommonFieldsGenerationInfo { // `control`. May be null for empty tables. void* slots_ = nullptr; + // The number of slots in the backing array. This is always 2^N-1 for an + // integer N. NOTE: we tried experimenting with compressing the capacity and + // storing it together with size_: (a) using 6 bits to store the corresponding + // power (N in 2^N-1), and (b) storing 2^N as the most significant bit of + // size_ and storing size in the low bits. Both of these experiments were + // regressions, presumably because we need capacity to do find operations. size_t capacity_ = 0; // Bundle together size and HashtablezInfoHandle to ensure EBO for |