EgorBot / runtime-utils

MIT License
0 stars 1 forks source link

EgorBot for EgorBo in #9 #16

Open EgorBot opened 2 weeks ago

EgorBot commented 2 weeks ago

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


-arm64 -perf -pr 107218

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 will reply in this issue)

EgorBot commented 2 weeks ago

Benchmark results on Arm64

BenchmarkDotNet v0.14.0, Ubuntu 22.04.4 LTS (Jammy Jellyfish)
Unknown processor
  Job-TBXVEN : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
  Job-XTDERF : .NET 10.0.0 (42.42.42.42424), Arm64 RyuJIT AdvSIMD
Method Toolchain Mean Error Ratio
Foo Main 9.515 μs 0.0601 μs 1.00
Foo PR 18.878 μs 0.0242 μs 1.98

BDN_Artifacts.zip

🔥 Flame graphs: Main vs PR

Hot asm: Main vs PR Hot functions: Main vs PR

For clean perf results, make sure you have just one [Benchmark] in your app.

EgorBot commented 2 weeks ago

Build log

cc @EgorBo