Several hints removed & code cleaned up.
This commit is contained in:
1 parent
b038bcfdc9
commit
52dc663ada
26 files changed
+107
-139
No files matched your search
@@ -6,7 +6,7 @@ using System.Runtime.CompilerServices;
|
||||
|
||||
namespace Recyclable.Collections.Benchmarks.POC
|
||||
{
|
||||
#region RecyclableList IndexOf
|
||||
#region RecyclableList IndexOf v1
|
||||
|
||||
internal class RecyclableListIndexOfV1<T> : IDisposable, IList<T>
|
||||
{
|
||||
@@ -404,10 +404,11 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
/// <param name="minBlockSize">Minimal requested block size. It MUST be rounded to the power of 2, see remarks.</param>
|
||||
/// <param name="minBlockSizePow2Shift">Pre-calculated bit shifting value for left & right shift operations against<paramref name="minBlockSize"/>.</param>
|
||||
/// <param name="newCapacity">The minimum no. of items <paramref name="list"/> MUST be able to store after <see cref="RecyclableList{T}.Resize(RecyclableList{T}, int, byte, long)"/>.</param>
|
||||
/// <remarks>For performance reasons, <paramref name="minBlockSize"/> MUST a power of 2. This simplifies a lot block & item
|
||||
/// <remarks><para>
|
||||
/// For performance reasons, <paramref name="minBlockSize"/> MUST a power of 2. This simplifies a lot block & item
|
||||
/// index calculations, i.e. makes them logical operations on bits.
|
||||
///
|
||||
/// This method checks for integral overflow.
|
||||
/// </para>
|
||||
/// <para>This method checks for integral overflow.</para>
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// This method doesn't support downsizing the memory block. As such it doesn't release excessive blocks. This is to for additional performance
|
||||
@@ -457,7 +458,7 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
}
|
||||
|
||||
blockIndex = sourceBlockCount;
|
||||
do
|
||||
while (true)
|
||||
{
|
||||
newMemoryBlocks[blockIndex] = blockArrayPool.Rent(minBlockSize);
|
||||
if (blockIndex + 1 < requiredBlockCount)
|
||||
@@ -468,24 +469,24 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
};
|
||||
}
|
||||
else
|
||||
{
|
||||
blockIndex = sourceBlockCount;
|
||||
do
|
||||
{
|
||||
newMemoryBlocks[blockIndex] = new T[minBlockSize];
|
||||
if (blockIndex + 1 < requiredBlockCount)
|
||||
{
|
||||
blockIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
newMemoryBlocks[blockIndex] = new T[minBlockSize];
|
||||
if (blockIndex + 1 < requiredBlockCount)
|
||||
{
|
||||
blockIndex++;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
list._reservedBlockCount = requiredBlockCount;
|
||||
@@ -773,7 +774,6 @@ namespace Recyclable.Collections.Benchmarks.POC
|
||||
{
|
||||
_nextItemIndex = checked((int)(targetCapacity & _blockSizeMinus1));
|
||||
_nextItemBlockIndex = targetBlockIndex;
|
||||
|
||||
}
|
||||
|
||||
_longCount = targetCapacity;
|
||||
|
||||
Reference in new issue
Block a user