ArrayPool<T> replaced with ThreadStaticPools

This commit is contained in:
mlemanczyk committed 2025-11-07 00:46:16 +01:00
1 parent c004e140db
commit 9537addf38
12 files changed
+123 -75

No files matched your search

+2 -2
View File
@@ -50,12 +50,12 @@ namespace PerfectNumbers.Core
FactorEntry[]? source = Factors;
if (source is null || Count == 0)
{
FactorEntry[] local = ArrayPool<FactorEntry>.Shared.Rent(1);
FactorEntry[] local = ThreadStaticPools.FactorEntryPool.Rent(1);
local[0] = new FactorEntry(prime, 1, true);
return Rent(local, 1UL, true, 1, false);
}
FactorEntry[] extended = ArrayPool<FactorEntry>.Shared.Rent(Count + 1);
FactorEntry[] extended = ThreadStaticPools.FactorEntryPool.Rent(Count + 1);
Array.Copy(source, 0, extended, 0, Count);
extended[Count] = new FactorEntry(prime, 1, true);
Span<FactorEntry> span = extended.AsSpan(0, Count + 1);