Isolate CPU divisor pools per thread

This commit is contained in:
Marek Lemańczyk committed 2025-10-11 21:17:12 +02:00
1 parent cd69c08fb4
commit 8e9390bc5e
7 files changed
+61 -34

No files matched your search

+2 -2
View File
@@ -1058,7 +1058,7 @@ internal static partial class PrimeOrderCalculator
return PartialFactorResult.Rent(null, cofactor, cofactor == 1UL, 0);
}
FactorEntry[] factors = ArrayPool<FactorEntry>.Shared.Rent(counts.Count);
FactorEntry[] factors = ThreadLocalArrayPool<FactorEntry>.Shared.Rent(counts.Count);
int index = 0;
foreach (KeyValuePair<ulong, int> entry in counts)
{
@@ -1092,7 +1092,7 @@ internal static partial class PrimeOrderCalculator
return PartialFactorResult.Rent(null, cofactor, cofactor == 1UL, 0);
}
FactorEntry[] array = ArrayPool<FactorEntry>.Shared.Rent(actualCount);
FactorEntry[] array = ThreadLocalArrayPool<FactorEntry>.Shared.Rent(actualCount);
int arrayIndex = 0;
for (int i = 0; i < factorCount; i++)
{