Skip to content

Commit 61e076b

Browse files
committed
std.ArrayHashMap: base linear_scan_max on cache line size
1 parent 4162f40 commit 61e076b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/std/array_hash_map.zig

+5-1
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,11 @@ pub fn ArrayHashMapUnmanaged(
605605

606606
const Self = @This();
607607

608-
const linear_scan_max = 8;
608+
const linear_scan_max = @max(1, @min(
609+
std.atomic.cache_line / @sizeOf(Hash),
610+
std.atomic.cache_line / @sizeOf(K),
611+
std.atomic.cache_line / @sizeOf(V),
612+
));
609613

610614
const RemovalType = enum {
611615
swap,

0 commit comments

Comments
 (0)