public static MemoryPool <TKey, TPayload> GetMemoryPool <TKey, TPayload>(bool isColumnar = true) { if (Config.ForceRowBasedExecution) { isColumnar = false; } var typeOfTKey = typeof(TKey); var typeOfTPayload = typeof(TPayload); var cacheKey = CacheKey.Create(typeof(TKey), typeof(TPayload), isColumnar); if (!isColumnar || (!typeOfTKey.KeyTypeNeedsGeneratedMemoryPool() && typeOfTPayload.MemoryPoolHasGetMethodFor())) { return((MemoryPool <TKey, TPayload>)memoryPools.GetOrAdd(cacheKey, key => new MemoryPool <TKey, TPayload>(isColumnar))); } if (!typeOfTPayload.CanRepresentAsColumnar()) { return((MemoryPool <TKey, TPayload>)memoryPools.GetOrAdd(cacheKey, new MemoryPool <TKey, TPayload>(false))); } var lookupKey = CacheKey.Create(typeOfTKey, typeOfTPayload); Type generatedMemoryPool = cachedMemoryPools.GetOrAdd(lookupKey, key => Transformer.GenerateMemoryPoolClass <TKey, TPayload>()); return((MemoryPool <TKey, TPayload>)memoryPools.GetOrAdd(cacheKey, t => Activator.CreateInstance(generatedMemoryPool))); }