Skip to content

Commit 2873afc

Browse files
ezbrcopybara-github
authored andcommitted
Prefetch from slots in parallel with reading from control.
This is inspired by a similar prefetch in boost::unordered_flat_map. PiperOrigin-RevId: 747982610 Change-Id: Ia5a99457dc93eb2c8e92fe08afdaf857964c57f1
1 parent 269ce47 commit 2873afc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

absl/container/internal/raw_hash_set.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,6 +3093,9 @@ class raw_hash_set {
30933093
const h2_t h2 = H2(hash);
30943094
const ctrl_t* ctrl = control();
30953095
while (true) {
3096+
#ifndef ABSL_HAVE_MEMORY_SANITIZER
3097+
absl::PrefetchToLocalCache(slot_array() + seq.offset());
3098+
#endif
30963099
Group g{ctrl + seq.offset()};
30973100
for (uint32_t i : g.Match(h2)) {
30983101
if (ABSL_PREDICT_TRUE(PolicyTraits::apply(
@@ -3320,6 +3323,9 @@ class raw_hash_set {
33203323
const h2_t h2 = H2(hash);
33213324
const ctrl_t* ctrl = control();
33223325
while (true) {
3326+
#ifndef ABSL_HAVE_MEMORY_SANITIZER
3327+
absl::PrefetchToLocalCache(slot_array() + seq.offset());
3328+
#endif
33233329
Group g{ctrl + seq.offset()};
33243330
for (uint32_t i : g.Match(h2)) {
33253331
if (ABSL_PREDICT_TRUE(PolicyTraits::apply(

0 commit comments

Comments
 (0)