@@ -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 ,
@@ -2376,7 +2379,7 @@ test "shrink" {
2376
2379
defer map .deinit ();
2377
2380
2378
2381
// This test is more interesting if we insert enough entries to allocate the index header.
2379
- const num_entries = 20 ;
2382
+ const num_entries = 200 ;
2380
2383
var i : i32 = 0 ;
2381
2384
while (i < num_entries ) : (i += 1 )
2382
2385
try testing .expect ((try map .fetchPut (i , i * 10 )) == null );
@@ -2387,7 +2390,7 @@ test "shrink" {
2387
2390
// Test `shrinkRetainingCapacity`.
2388
2391
map .shrinkRetainingCapacity (17 );
2389
2392
try testing .expect (map .count () == 17 );
2390
- try testing .expect (map .capacity () == 20 );
2393
+ try testing .expect (map .capacity () >= num_entries );
2391
2394
i = 0 ;
2392
2395
while (i < num_entries ) : (i += 1 ) {
2393
2396
const gop = try map .getOrPut (i );
@@ -2436,7 +2439,7 @@ test "reIndex" {
2436
2439
defer map .deinit ();
2437
2440
2438
2441
// Populate via the API.
2439
- const num_indexed_entries = 20 ;
2442
+ const num_indexed_entries = 200 ;
2440
2443
var i : i32 = 0 ;
2441
2444
while (i < num_indexed_entries ) : (i += 1 )
2442
2445
try testing .expect ((try map .fetchPut (i , i * 10 )) == null );
0 commit comments