@@ -605,7 +605,10 @@ pub fn ArrayHashMapUnmanaged(
605
605
606
606
const Self = @This ();
607
607
608
- const linear_scan_max = 8 ;
608
+ const linear_scan_max = @as (comptime_int , @max (1 , @as (comptime_int , @min (
609
+ std .atomic .cache_line / @as (comptime_int , @max (1 , @sizeOf (Hash ))),
610
+ std .atomic .cache_line / @as (comptime_int , @max (1 , @sizeOf (K ))),
611
+ ))));
609
612
610
613
const RemovalType = enum {
611
614
swap ,
@@ -2393,7 +2396,7 @@ test "shrink" {
2393
2396
defer map .deinit ();
2394
2397
2395
2398
// This test is more interesting if we insert enough entries to allocate the index header.
2396
- const num_entries = 20 ;
2399
+ const num_entries = 200 ;
2397
2400
var i : i32 = 0 ;
2398
2401
while (i < num_entries ) : (i += 1 )
2399
2402
try testing .expect ((try map .fetchPut (i , i * 10 )) == null );
@@ -2404,7 +2407,7 @@ test "shrink" {
2404
2407
// Test `shrinkRetainingCapacity`.
2405
2408
map .shrinkRetainingCapacity (17 );
2406
2409
try testing .expect (map .count () == 17 );
2407
- try testing .expect (map .capacity () == 20 );
2410
+ try testing .expect (map .capacity () >= num_entries );
2408
2411
i = 0 ;
2409
2412
while (i < num_entries ) : (i += 1 ) {
2410
2413
const gop = try map .getOrPut (i );
@@ -2453,7 +2456,7 @@ test "reIndex" {
2453
2456
defer map .deinit ();
2454
2457
2455
2458
// Populate via the API.
2456
- const num_indexed_entries = 20 ;
2459
+ const num_indexed_entries = 200 ;
2457
2460
var i : i32 = 0 ;
2458
2461
while (i < num_indexed_entries ) : (i += 1 )
2459
2462
try testing .expect ((try map .fetchPut (i , i * 10 )) == null );
0 commit comments