Skip to content

Commit

Permalink
hash_map: update doc comments for rehash()
Browse files Browse the repository at this point in the history
  • Loading branch information
mrjbq7 committed Feb 7, 2024
1 parent 68b64f8 commit 0965fe5
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion lib/std/hash_map.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1509,7 +1509,16 @@ pub fn HashMapUnmanaged(
return result;
}

/// Rehash the map, in-place
/// Rehash the map, in-place.
///
/// Over time, due to the current tombstone-based implementation, a
/// HashMap could become fragmented due to the buildup of tombstone
/// entries that causes a performance degradation due to excessive
/// probing. The kind of pattern that might cause this is a long-lived
/// HashMap with repeated inserts and deletes.
///
/// All existing key/value pointers in the HashMap are maintained at
/// their new rehashed location.
pub fn rehash(self: *Self, ctx: anytype) void {
const mask = self.capacity() - 1;

Expand Down

0 comments on commit 0965fe5

Please sign in to comment.