Tiny cleanup. Commented out code removed.
This commit is contained in:
1 parent
f66b129f3a
commit
413d625d8e
2 files changed
-63
No files matched your search
@@ -16,9 +16,6 @@ namespace Recyclable.Collections
|
||||
#nullable disable
|
||||
private T[] _memoryBlock;
|
||||
#nullable restore
|
||||
// & WAS SLOWER
|
||||
// internal RecyclableCollectionVersion _version;
|
||||
// public RecyclableCollectionVersion Version => _version;
|
||||
|
||||
private ulong _version;
|
||||
public ulong Version => _version;
|
||||
@@ -85,11 +82,6 @@ namespace Recyclable.Collections
|
||||
if (source?.Length > 0)
|
||||
{
|
||||
Array.Copy(source!, 0, newMemoryBlock, 0, source!.Length);
|
||||
//var sourceSpan = new Memory<T>(source);
|
||||
//var newArraySpan = new Memory<T>(newMemoryBlock);
|
||||
|
||||
//sourceSpan.CopyTo(newArraySpan);
|
||||
|
||||
if (source!.Length >= RecyclableDefaults.MinPooledArrayLength)
|
||||
{
|
||||
arrayPool.Return(source!, NeedsClearing);
|
||||
@@ -221,22 +213,6 @@ namespace Recyclable.Collections
|
||||
|
||||
private int _count;
|
||||
public int Count => _count;
|
||||
//{
|
||||
// [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
// get => _count;
|
||||
|
||||
// [MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
// // TODO: Clear items if we're decreasing the size of the list, if T is reference type
|
||||
// set
|
||||
// {
|
||||
// _count = value;
|
||||
|
||||
// if (_version?.IsVersioned ?? false)
|
||||
// {
|
||||
// _version.Inc();
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
public bool IsReadOnly => false;
|
||||
|
||||
|
||||
@@ -346,41 +346,6 @@ namespace Recyclable.Collections
|
||||
return minBlockSize;
|
||||
}
|
||||
|
||||
// & WAS SLOWER
|
||||
// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
// & WAS SLOWER
|
||||
// [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
|
||||
// & WAS SLOWER
|
||||
// [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.NoOptimization)]
|
||||
// & WAS SLOWER
|
||||
// [MethodImpl(MethodImplOptions.NoInlining)]
|
||||
//private static void Iterate(RecyclableLongList<T> list, in ParallelSynchronizationContext context, in T itemToFind)
|
||||
//{
|
||||
// // TODO: Switch to use _blockSize instead of list._longCountIndeexOfStep for simplifications & better performance.
|
||||
|
||||
// // & WAS SLOWER without
|
||||
// int blockIndex = 0;
|
||||
|
||||
// long itemsCount = list._longCount;
|
||||
// // & WAS SLOWER
|
||||
// // int blockSize = _blockSize;
|
||||
// // & WAS SLOWER
|
||||
// // while ((blockIndex << list._blockSizePow2BitShift) + itemIndex > step)
|
||||
// while (itemsCount > list._blockSize)
|
||||
// {
|
||||
// // At this point itemIndex is limited to blockSize range - int.
|
||||
// if (!ScheduleIndexOfTask(context, list, blockIndex, list._blockSize, itemToFind))
|
||||
// {
|
||||
// break;
|
||||
// }
|
||||
|
||||
// itemsCount -= list._blockSize;
|
||||
// blockIndex++;
|
||||
// }
|
||||
|
||||
// _ = ScheduleIndexOfTask(context, list, blockIndex, (int)itemsCount, itemToFind);
|
||||
//}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
|
||||
protected static void SetupBlockArrayPooling(RecyclableLongList<T> list, int blockSize, ArrayPool<T>? blockArrayPool = null)
|
||||
{
|
||||
@@ -1134,8 +1099,6 @@ namespace Recyclable.Collections
|
||||
}
|
||||
else
|
||||
{
|
||||
// & WAS SLOWER
|
||||
// long toSearch = _longCount - _blockSize;
|
||||
if (_longCount > _blockSize)
|
||||
{
|
||||
itemIndex = Array.IndexOf(_memoryBlocks[1], item, 0, (int)Math.Min(_blockSize, _longCount - _blockSize));
|
||||
@@ -1173,8 +1136,6 @@ namespace Recyclable.Collections
|
||||
}
|
||||
else
|
||||
{
|
||||
// & WAS SLOWER
|
||||
// long toSearch = _longCount - _blockSize;
|
||||
if (_longCount > _blockSize)
|
||||
{
|
||||
itemIndex = Array.IndexOf(_memoryBlocks[1], item, 0, (int)Math.Min(_blockSize, _longCount - _blockSize));
|
||||
|
||||
Reference in new issue
Block a user