diff --git a/Misaki.HighPerformance.Jobs/JobScheduler.cs b/Misaki.HighPerformance.Jobs/JobScheduler.cs index e9691e1..0520cf7 100644 --- a/Misaki.HighPerformance.Jobs/JobScheduler.cs +++ b/Misaki.HighPerformance.Jobs/JobScheduler.cs @@ -532,7 +532,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable return JobHandle.Invalid; } - Unsafe.Copy(pJobData, in job); + *(T*)pJobData = job; var jobInfo = new JobInfo { @@ -569,10 +569,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable return JobHandle.Invalid; } - fixed (T* pJob = &job) - { - NativeMemory.Copy(pJobData, pJob, (nuint)sizeof(T)); - } + *(T*)pJobData = job; var optimalBatchSize = Math.Max(1, batchSize); var totalBatches = (totalIteration + optimalBatchSize - 1) / optimalBatchSize; @@ -617,10 +614,7 @@ public sealed unsafe partial class JobScheduler : IJobScheduler, IDisposable return JobHandle.Invalid; } - fixed (T* pJob = &job) - { - NativeMemory.Copy(pJobData, pJob, (nuint)sizeof(T)); - } + *(T*)pJobData = job; var optimalBatchSize = Math.Max(1, batchSize); var totalBatches = (totalIteration + optimalBatchSize - 1) / optimalBatchSize; diff --git a/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj b/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj index 05578a5..3e3e220 100644 --- a/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj +++ b/Misaki.HighPerformance.Jobs/Misaki.HighPerformance.Jobs.csproj @@ -6,7 +6,7 @@ enable True True - 1.5.6 + 1.5.7 $(AssemblyVersion) Misaki https://git.personalnas.com/Misaki/Misaki.HighPerformance.git diff --git a/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs b/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs index f45b3ba..83c2419 100644 --- a/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs +++ b/Misaki.HighPerformance.LowLevel/Buffer/AllocationManager.cs @@ -54,6 +54,13 @@ public readonly struct AllocationManagerInitOpts { get; init; } + + public static AllocationManagerInitOpts Default => new AllocationManagerInitOpts + { + ArenaCapacity = 1024 * 1024 * 1024, // 1 GB + StackCapacity = 16 * 1024 * 1024, // 16 MB per thread + FreeListConcurrencyLevel = Environment.ProcessorCount + }; } /// diff --git a/Misaki.HighPerformance.Test/UnitTest/Jobs/TestJobSystem.cs b/Misaki.HighPerformance.Test/UnitTest/Jobs/TestJobSystem.cs index dfe7652..511d7dc 100644 --- a/Misaki.HighPerformance.Test/UnitTest/Jobs/TestJobSystem.cs +++ b/Misaki.HighPerformance.Test/UnitTest/Jobs/TestJobSystem.cs @@ -22,6 +22,7 @@ public unsafe class TestJobSystem [ClassInitialize] public static void Initialize(TestContext testContext) { + AllocationManager.Initialize(AllocationManagerInitOpts.Default); s_jobScheduler = new JobScheduler(3); }