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