Skip to content

Commit 1604045

Browse files
committed
Auto merge of #361 - JustForFun88:improve_rehashing, r=Amanieu
Small improvement in `RawTableInner::rehash_in_place` function Small improvement on rehashing. There is no point in calculating the memory place first if we exit the loop in the next step.
2 parents 22c7dbc + 5f059ce commit 1604045

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/raw/mod.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1507,7 +1507,6 @@ impl<A: Allocator + Clone> RawTableInner<A> {
15071507

15081508
// Search for a suitable place to put it
15091509
let new_i = guard.find_insert_slot(hash);
1510-
let new_i_p = guard.bucket_ptr(new_i, size_of);
15111510

15121511
// Probing works by scanning through all of the control
15131512
// bytes in groups, which may not be aligned to the group
@@ -1519,6 +1518,8 @@ impl<A: Allocator + Clone> RawTableInner<A> {
15191518
continue 'outer;
15201519
}
15211520

1521+
let new_i_p = guard.bucket_ptr(new_i, size_of);
1522+
15221523
// We are moving the current item to a new position. Write
15231524
// our H2 to the control byte of the new position.
15241525
let prev_ctrl = guard.replace_ctrl_h2(new_i, hash);

0 commit comments

Comments
 (0)