EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #9 #14

Open EgorBot opened 2 months ago

EgorBot commented 2 months ago

Processing https://github.com/EgorBot/runtime-utils/issues/9#issuecomment-2323496687:


-intel -perf

using System;
using System.Runtime.CompilerServices;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Running;

BenchmarkRunner.Run<Bench>(args: args);

public class Bench
{
    [Benchmark]
    public void Foo()
    {
        for (int i = 0; i < 1000; i++)
            Work<char>(1);
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    static void Work<T>(int size) => GC.KeepAlive(GC.AllocateUninitializedArray<T>(size));
}
EgorBot commented 2 months ago

Benchmark results on 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
DefaultJob : .NET 9.0.0 (9.0.24.40507), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
StdDev=0.0856 μs
Method Mean Error
Foo 7.199 μs 0.0915 μs

BDN_Artifacts.zip

EgorBot commented 2 months ago

Build log

cc @EgorBo