Open EgorBot opened 2 months ago
Intel
BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Intel Xeon Platinum 8370C CPU 2.80GHz, 1 CPU, 16 logical and 8 physical cores
Job-VMAGSR : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Job-CTTJLC : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method | Toolchain | Mean | Error | Ratio |
---|---|---|---|---|
StelemRef | Main | 5.237 ns | 0.0007 ns | 1.00 |
StelemRef | PR | 5.302 ns | 0.0005 ns | 1.01 |
BulkCopy_heap | Main | 8.147 ns | 0.0233 ns | 1.00 |
BulkCopy_heap | PR | 8.170 ns | 0.0310 ns | 1.00 |
BulkCopy_stack | Main | 8.439 ns | 0.0109 ns | 1.00 |
BulkCopy_stack | PR | 8.578 ns | 0.0201 ns | 1.02 |
@EgorBot -arm64 -pr 107437
using BenchmarkDotNet.Attributes;
using System;
using System.Runtime.CompilerServices;
public class Proga
{
static object[] test1 = [null, null, null];
static object[] test2 = [null, null, null];
static object val = null;
[Benchmark]
public void StelemRef()
{
test1[0] = val;
test1[1] = val;
test1[2] = val;
}
[Benchmark]
public void BulkCopy_heap()
{
test1.AsSpan().CopyTo(test2);
}
[Benchmark]
public void BulkCopy_stack()
{
MyStruct ms = default;
Copy(ref ms, default);
}
[MethodImpl(MethodImplOptions.NoInlining)]
static void Copy(ref MyStruct dst, MyStruct src) => dst = src;
public record struct MyStruct(object o1, object o2, object o3, object o4);
}
Processing https://github.com/dotnet/runtime/pull/107437#issuecomment-2332930480 command:
Command
-arm64 -intel ```cs using BenchmarkDotNet.Attributes; using System; using System.Runtime.CompilerServices; public class Proga { static object[] test1 = [null, null, null]; static object[] test2 = [null, null, null]; static object val = null; [Benchmark] public void StelemRef() { test1[0] = val; test1[1] = val; test1[2] = val; } [Benchmark] public void BulkCopy_heap() { test1.AsSpan().CopyTo(test2); } [Benchmark] public void BulkCopy_stack() { MyStruct ms = default; Copy(ref ms, default); } [MethodImpl(MethodImplOptions.NoInlining)] static void Copy(ref MyStruct dst, MyStruct src) => dst = src; public record struct MyStruct(object o1, object o2, object o3, object o4); } ```(EgorBot will reply in this issue)