BenchmarkDotNet v0.13.12, Windows 10 (10.0.19045.3208/22H2/2022Update)
Intel Core i7-8550U CPU 1.80GHz (Kaby Lake R), 1 CPU, 8 logical and 4 physical cores
.NET SDK 8.0.100
[Host] : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
DefaultJob : .NET 8.0.0 (8.0.23.53103), X64 RyuJIT AVX2
Method | Mean | Error | StdDev | Gen0 | Gen1 | Allocated |
ClassAllocSumForget | 155.68 ns | 1.608 ns | 1.425 ns | 0.0880 | - | 368 B |
ClassAllocSumSaveInLastField | 179.87 ns | 1.211 ns | 1.133 ns | 0.0880 | - | 368 B |
ClassAllocSumSaveInSmallArray | 200.24 ns | 3.746 ns | 3.321 ns | 0.0880 | - | 368 B |
ClassAllocSumSaveInMediumArray | 261.18 ns | 3.055 ns | 2.858 ns | 0.0587 | 0.0582 | 368 B |
ClassAllocSumSaveInBigArray | 1,100.45 ns | 21.548 ns | 34.178 ns | 0.0572 | 0.0286 | 368 B |
StructAllocSumForget | 98.25 ns | 1.018 ns | 0.953 ns | 0.0305 | - | 128 B |
StructAllocSumSaveInLastField | 100.64 ns | 2.014 ns | 2.068 ns | 0.0305 | - | 128 B |
StructAllocSumSaveInMediumArray | 100.09 ns | 1.158 ns | 0.904 ns | 0.0305 | - | 128 B |
StructReuseSumClear | 70.79 ns | 0.095 ns | 0.079 ns | - | - | - |
StructAllocSumForget_UNFAIR | 42.97 ns | 0.160 ns | 0.134 ns | 0.0306 | - | 128 B |