Closed bashimao closed 2 years ago
Hi @greg7mdp ,
bool find_impl(const key_arg<K>& key, size_t hashval, size_t& offset) { auto seq = probe(hashval); while (true) { Group g{ ctrl_ + seq.offset() }; for (uint32_t i : g.Match((h2_t)H2(hashval))) { offset = seq.offset((size_t)i); if (PHMAP_PREDICT_TRUE(PolicyTraits::apply( EqualElement<K>{key, eq_ref()}, PolicyTraits::element(slots_ + offset)))) return true; } if (PHMAP_PREDICT_TRUE(g.MatchEmpty())) return false; seq.next(); } }
may I ask a couple of questions:
a) Is my understanding correct that (assuming SSE impl: kWidth = 16):
kWidth = 16
probe_seq.next()
b) However, isn't (3) highly unlikely if the table pretty full (>80%) and has lots of tombstones?
Wouldn't this algorithm result in an infinite loop? How is that prevented from happening?
If not you check, if all 16 slots were empty. If so, we can quit right away.
any
Oh, my bad. Thanks. I must have misread the code.
Hi @greg7mdp ,
may I ask a couple of questions:
a) Is my understanding correct that (assuming SSE impl:
kWidth = 16
):probe_seq.next()
.b) However, isn't (3) highly unlikely if the table pretty full (>80%) and has lots of tombstones?
Wouldn't this algorithm result in an infinite loop? How is that prevented from happening?