diff --git a/source/Ecs.CSharp.Benchmark/SystemWithThreeComponents/FrifloEngineEcs.cs b/source/Ecs.CSharp.Benchmark/SystemWithThreeComponents/FrifloEngineEcs.cs index ae819eb..9493ad3 100644 --- a/source/Ecs.CSharp.Benchmark/SystemWithThreeComponents/FrifloEngineEcs.cs +++ b/source/Ecs.CSharp.Benchmark/SystemWithThreeComponents/FrifloEngineEcs.cs @@ -56,7 +56,7 @@ public void FrifloEngineEcs_MultiThread() private static void Update(ref Component1 c1, ref Component2 c2, ref Component3 c3) { - c1.Value = c2.Value + c3.Value; + c1.Value += c2.Value + c3.Value; } [BenchmarkCategory(Categories.FrifloEngineEcs)] @@ -72,10 +72,12 @@ public void FrifloEngineEcs_SIMD_MonoThread() int step = component1.StepSpan256; // step = 8 for (int n = 0; n < component1Span.Length; n += step) { - Vector256 value1 = Vector256.Create(component1Span.Slice(n, step)); + Span component1Slice = component1Span.Slice(n, step); + Vector256 value1 = Vector256.Create(component1Span); Vector256 value2 = Vector256.Create(component2Span.Slice(n, step)); - Vector256 result = Vector256.Add(value1, value2); // execute 8 add instructions at once - result.CopyTo(component3Span.Slice(n, step)); + Vector256 value3 = Vector256.Create(component3Span.Slice(n, step)); + Vector256 result = Vector256.Add(value1, Vector256.Add(value2, value3)); // execute 16 add instructions + result.CopyTo(component1Slice); } } }