Source code cleanup

This commit is contained in:
mlemanczyk committed 2023-01-28 14:19:50 +01:00
1 parent 680776f259
commit c72b18ad1d
2 files changed
+5 -5

No files matched your search

@@ -14,7 +14,7 @@ namespace Recyclable.Collections.Benchmarks
[Benchmark] [Benchmark]
public void RecyclableList_Create_WithCapacity() public void RecyclableList_Create_WithCapacity()
{ {
using var list = new RecyclableList<object>(blockSize: 102_400, initialCapacity: TestObjectCount); using var list = new RecyclableList<object>(blockSize: 102_400, expectedItemsCount: TestObjectCount);
DoNothing(list); DoNothing(list);
} }
@@ -35,7 +35,7 @@ namespace Recyclable.Collections.Benchmarks
{ {
var data = TestObjects; var data = TestObjects;
var dataCount = TestObjectCount; var dataCount = TestObjectCount;
using var list = new RecyclableList<object>(blockSize: 102_400, initialCapacity: dataCount); using var list = new RecyclableList<object>(blockSize: 102_400, expectedItemsCount: dataCount);
for (var i = 0; i < dataCount; i++) for (var i = 0; i < dataCount; i++)
{ {
list.Add(data[i]); list.Add(data[i]);
+3 -3
View File
@@ -206,12 +206,12 @@ namespace Recyclable.Collections
return newCapacity; return newCapacity;
} }
public RecyclableList(int blockSize = RecyclableDefaults.BlockSize, long? initialCapacity = default) public RecyclableList(int blockSize = RecyclableDefaults.BlockSize, long? expectedItemsCount = default)
{ {
switch (initialCapacity > 0) switch (expectedItemsCount > 0)
{ {
case true: case true:
_memoryBlocks = SetNewLength(_memoryBlocks, blockSize, initialCapacity.Value); _memoryBlocks = SetNewLength(_memoryBlocks, blockSize, expectedItemsCount.Value);
if (_memoryBlocks.Length > 0) if (_memoryBlocks.Length > 0)
{ {
blockSize = _memoryBlocks[0].Length; blockSize = _memoryBlocks[0].Length;