RecyclableArrayList.AsArray() method converted to property for better performance.

This commit is contained in:
mlemanczyk committed 2023-04-30 22:21:58 +02:00
1 parent 3b73a2d877
commit 13fa23ac13
3 files changed
+4 -4

No files matched your search

@@ -498,7 +498,7 @@ namespace Recyclable.Collections.Benchmarks.POC
targetBlockIndex = _nextItemBlockIndex,
memoryBlockCount = _memoryBlocks.Length;
Span<T> itemsSpan = new(items.AsArray(), 0, items.Count);
Span<T> itemsSpan = new(items.AsArray, 0, items.Count);
Span<T[]> memoryBlocksSpan = new(_memoryBlocks, 0, memoryBlockCount);
Span<T> targetBlockArraySpan = new(memoryBlocksSpan[targetBlockIndex], _nextItemIndex, blockSize - _nextItemIndex);
while (targetBlockArraySpan.Length <= itemsSpan.Length)
@@ -1397,7 +1397,7 @@ namespace Recyclable.Collections.Benchmarks.POC
targetBlockIndex = _nextItemBlockIndex,
memoryBlockCount = _memoryBlocks.Length;
Span<T> itemsSpan = new(items.AsArray(), 0, items.Count);
Span<T> itemsSpan = new(items.AsArray, 0, items.Count);
Span<T[]> memoryBlocksSpan = new(_memoryBlocks, 0, memoryBlockCount);
Span<T> targetBlockArraySpan = new(memoryBlocksSpan[targetBlockIndex], _nextItemIndex, blockSize - _nextItemIndex);
while (targetBlockArraySpan.Length <= itemsSpan.Length)