Skip to content

Commit 43b0b1c

Browse files
committed
cleanup
1 parent 0f0befb commit 43b0b1c

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/Combination.StringPools/Utf8StringPool.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ private const int
1313
PoolIndexBits =
1414
24; // Number of bits to use for pool index in handle (more bits = more pools, but less strings per pool)
1515

16+
// Maximum fill factor for deduplication table. Performance degrades when it is close to 1.
17+
private const float MaxDeduplicationTableFillFactor = 0.8f;
18+
1619
private static readonly List<Utf8StringPool?> Pools = new();
1720

1821
#pragma warning disable IDE1006 // Naming Styles
@@ -311,7 +314,7 @@ private void AddToDeduplicationTable(ulong[]? currentTable, int currentTableBits
311314
{
312315
++deduplicationFillCount;
313316
currentTable[(tableIndex + i) % tableSize] = handle + 1;
314-
if (deduplicationFillCount > tableSize * 0.8)
317+
if (deduplicationFillCount > tableSize * MaxDeduplicationTableFillFactor)
315318
{
316319
ResizeDeduplicationTable(currentTableBits + 1);
317320
}

0 commit comments

Comments
 (0)