Skip to content

Commit

Permalink
Further testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
DJGosnell committed Nov 29, 2023
1 parent a534841 commit 4e0579b
Show file tree
Hide file tree
Showing 13 changed files with 1,858 additions and 116 deletions.
2 changes: 1 addition & 1 deletion src/DtronixCommon.Tests/DtronixCommon.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net7.0</TargetFramework>
<Nullable>enable</Nullable>

<IsPackable>false</IsPackable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace DtronixCommon.Collections.Lists;
/// List of double with varying size with a backing array. Items erased are returned to be reused.
/// </summary>
/// <remarks>https://stackoverflow.com/a/48354356</remarks>
public class DoubleList2 : IDisposable
public class DoubleStructList : IDisposable
{
[StructLayout(LayoutKind.Explicit)]
public struct ValType
Expand Down Expand Up @@ -44,10 +44,10 @@ public class Cache
public class Item
{
public readonly long ExpireTime;
public readonly DoubleList2 List;
public readonly DoubleStructList List;
private readonly ConcurrentQueue<Item> _returnQueue;

public Item(DoubleList2 list, ConcurrentQueue<Item> queue)
public Item(DoubleStructList list, ConcurrentQueue<Item> queue)
{
List = list;
_returnQueue = queue;
Expand All @@ -70,7 +70,7 @@ public Item Get()
{
if (!_cachedLists.TryDequeue(out var list))
{
return new Item(new DoubleList2(_fieldCount), _cachedLists);
return new Item(new DoubleStructList(_fieldCount), _cachedLists);
}

return list;
Expand Down Expand Up @@ -108,7 +108,7 @@ public Item Get()
/// Capacity starts starts at 128.
/// </summary>
/// <param name="fieldCount">Number of fields </param>
public DoubleList2(int fieldCount)
public DoubleStructList(int fieldCount)
: this(fieldCount, 128)
{
}
Expand All @@ -119,7 +119,7 @@ public DoubleList2(int fieldCount)
/// </summary>
/// <param name="fieldCount"></param>
/// <param name="capacity">Number of total elements this collection supports. This ignores fieldCount.</param>
public DoubleList2(int fieldCount, int capacity)
public DoubleStructList(int fieldCount, int capacity)
{
_numFields = fieldCount;
_data = new ValType[capacity];
Expand Down
Loading

0 comments on commit 4e0579b

Please sign in to comment.