Recycle small prime stepper arrays
This commit is contained in:
1 parent
06b08708d9
commit
ca0f498d0d
5 files changed
+1744
-1642
No files matched your search
@@ -11,6 +11,18 @@ namespace PerfectNumbers.Core
|
||||
[ThreadStatic]
|
||||
private static ArrayPool<FactorEntry>? _factorEntryPool;
|
||||
|
||||
[ThreadStatic]
|
||||
private static ArrayPool<CycleRemainderStepper>? _cycleRemainderStepperPool;
|
||||
|
||||
public static ArrayPool<CycleRemainderStepper> CycleRemainderStepperPool
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return _cycleRemainderStepperPool ??= ArrayPool<CycleRemainderStepper>.Create();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayPool<FactorEntry> FactorEntryPool
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -70,6 +82,18 @@ namespace PerfectNumbers.Core
|
||||
[ThreadStatic]
|
||||
private static ArrayPool<ulong>? _ulongPool;
|
||||
|
||||
[ThreadStatic]
|
||||
private static ArrayPool<bool>? _boolPool;
|
||||
|
||||
public static ArrayPool<bool> BoolPool
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get
|
||||
{
|
||||
return _boolPool ??= ArrayPool<bool>.Create();
|
||||
}
|
||||
}
|
||||
|
||||
public static ArrayPool<ulong> UlongPool
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
|
||||
Reference in new issue
Block a user