Added scalar operator overloads for Vector types, fixed pointer math in Store methods, and improved enumerator and memory management. Updated test setup and removed allocation leak tests. - Added left-hand scalar operator overloads for Vector2/3/4. - Fixed pointer arithmetic in Store and GetUnsafePtr methods. - Marked SetValue as readonly in UnsafeSparseSet. - Improved enumerator initialization/reset for slot map and sparse set. - Updated test projects' AssemblyVersion. - Removed TestAllocationManager and added global AllocationManager setup/teardown. - Updated TestConcurrentSlotMap for thread safety and correct cancellation. - Minor formatting and parameter improvements.
42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
using Misaki.HighPerformance.LowLevel.Buffer;
|
|
using Misaki.HighPerformance.LowLevel.Collections;
|
|
|
|
//BenchmarkRunner.Run<SPMDBenchmark>();
|
|
|
|
var opts = new AllocationManagerInitOpts
|
|
{
|
|
ArenaCapacity = 1024 * 1024,
|
|
StackCapacity = 1024 * 1024,
|
|
FreeListConcurrencyLevel = 1
|
|
};
|
|
|
|
var pool = new MemoryPool<VirtualStack, VirtualStack.CreationOpts>(new VirtualStack.CreationOpts
|
|
{
|
|
reserveCapacity = 1024 * 1024
|
|
});
|
|
|
|
var arr = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
|
|
Test(in pool);
|
|
arr.Dispose();
|
|
|
|
Console.WriteLine("Done.");
|
|
|
|
void Test(ref readonly MemoryPool<VirtualStack, VirtualStack.CreationOpts> pool)
|
|
{
|
|
using var arr = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
if (true)
|
|
{
|
|
using var arr1 = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
}
|
|
|
|
using var arr3 = Test2(in pool);
|
|
using var arr2 = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
}
|
|
|
|
UnsafeArray<int> Test2(ref readonly MemoryPool<VirtualStack, VirtualStack.CreationOpts> pool)
|
|
{
|
|
using var arr = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
var arr1 = new UnsafeArray<int>(1000, pool.AllocationHandle);
|
|
return arr1;
|
|
} |