using System.Buffers; using System.Runtime.CompilerServices; namespace PerfectNumbers.Core { public static class ThreadStaticPools { [ThreadStatic] private static ArrayPool? _factorEntryPool; public static ArrayPool FactorEntryPool { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _factorEntryPool ??= ArrayPool.Create(); } } [ThreadStatic] private static ArrayPool? _factorEntry128Pool; public static ArrayPool FactorEntry128Pool { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _factorEntry128Pool ??= ArrayPool.Create(); } } [ThreadStatic] private static ArrayPool? _ulongPool; public static ArrayPool UlongPool { [MethodImpl(MethodImplOptions.AggressiveInlining)] get { return _ulongPool ??= ArrayPool.Create(); } } } }