Pools renamed to FixedCapacityPools. Other fixed capacity collections added. Queues, concurrent queues and standard stacks replaced with fixed capacity stacks. MethodImplOptions.AggressiveInlining and .AggressiveOptimization added to simple methods and getters / setters. Variables optimized in few places.
This commit is contained in:
1 parent
547d43de84
commit
260aa19e44
25 files changed
+1372
-1300
No files matched your search
@@ -0,0 +1,37 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace PerfectNumbers.Core
|
||||
{
|
||||
public static class FixedCapacityPools<T>
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static FixedCapacityArrayPool<T>? _arrayPool;
|
||||
internal static FixedCapacityArrayPool<T> ExclusiveArray
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
get => _arrayPool ??= new(PerfectNumberConstants.DefaultPoolCapacity);
|
||||
}
|
||||
}
|
||||
|
||||
public static class FixedCapacityPools
|
||||
{
|
||||
[ThreadStatic]
|
||||
private static IntArrayPool? _intArrayPool;
|
||||
internal static IntArrayPool ExclusiveIntArray
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
get => _intArrayPool ??= new(PerfectNumberConstants.DefaultPoolCapacity);
|
||||
}
|
||||
|
||||
[ThreadStatic]
|
||||
private static UlongArrayPool? _ulongArrayPool;
|
||||
internal static UlongArrayPool ExclusiveUlongArray
|
||||
{
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
get => _ulongArrayPool ??= new(PerfectNumberConstants.DefaultPoolCapacity);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user