Support for custom boundaries implemented. v1 - will be reverted due to 5x slower performance.

This commit is contained in:
mlemanczyk committed 2023-09-17 13:12:16 +02:00
1 parent 1ded5de37a
commit 22d8593e1f
12 files changed
+192 -92

No files matched your search

@@ -150,7 +150,7 @@ namespace Recyclable.Collections
if (requiredBlockCount > sourceBlockCount)
{
// Allocate new memory block for all arrays
newMemoryBlocks = requiredBlockCount >= RecyclableDefaults.MinPooledArrayLength ? RecyclableArrayPool<T[]>.RentShared(requiredBlockCount) : new T[requiredBlockCount][];
newMemoryBlocks = requiredBlockCount >= RecyclableDefaults.MinPooledArrayLength ? (T[][])RecyclableArrayPool<T[]>.RentShared(requiredBlockCount) : new T[requiredBlockCount][];
// Copy arrays from the old memory block for all arrays
if (sourceBlockCount > 0)
@@ -179,7 +179,7 @@ namespace Recyclable.Collections
ref OneSizeArrayPool<T> blockArrayPool = ref RecyclableArrayPool<T>.Shared(minBlockSize);
while (blockIndex >= 0 && newMemoryBlocks[blockIndex] == null)
{
newMemoryBlocks[blockIndex--] = blockArrayPool.Rent();
newMemoryBlocks[blockIndex--] = (T[])blockArrayPool.Rent();
}
}
else