Skip to content

Commit

Permalink
[Removed] useless rehash call
Browse files Browse the repository at this point in the history
 * it is not needed to rehash all elements after resize
   the neighborhood
  • Loading branch information
EinfachAndy committed Jul 6, 2023
1 parent 42c84ad commit 818a320
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions hopscotch.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,10 +249,8 @@ func (m *Hopscotch[K, V]) emplace(key K, val V, homeIdx uintptr) {
// move closer does not work, we need to find another solution!
if m.neighborhoodSize < 32 {
m.neighborhoodSize = 2 * m.neighborhoodSize
m.rehash(capacity)
} else if m.neighborhoodSize < uint8(maxNeighborhoodSize-1) {
m.neighborhoodSize = uint8(maxNeighborhoodSize)
m.rehash(capacity)
} else {
// that is the last hope to achieve the neighborhood invariant,
// but this case should happen really rare.
Expand Down

0 comments on commit 818a320

Please sign in to comment.