mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
Stop searching if we've already overshot where it could be
This commit is contained in:
parent
bb5bd04b5f
commit
a4a2856cb7
|
@ -142,6 +142,13 @@ impl<K, V, ALLOCATOR: ClonableAllocator> NodeStorage<K, V, ALLOCATOR> {
|
|||
let location = (hash + distance_to_initial_bucket).fast_mod(self.backing_vec_size());
|
||||
|
||||
let node = &self.nodes[location];
|
||||
|
||||
// if we've seen a node which is further from home than what we'd expect to find, then
|
||||
// our node cannot exist because it would've been inserted here.
|
||||
if node.distance() < distance_to_initial_bucket {
|
||||
return None;
|
||||
}
|
||||
|
||||
let node_key_ref = node.key_ref()?;
|
||||
|
||||
if node_key_ref.borrow() == key {
|
||||
|
|
Loading…
Reference in a new issue