Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EgorBot for jkotas in #111088 #223

Open
EgorBot opened this issue Jan 4, 2025 · 1 comment
Open

EgorBot for jkotas in #111088 #223

EgorBot opened this issue Jan 4, 2025 · 1 comment

Comments

@EgorBot
Copy link
Owner

EgorBot commented Jan 4, 2025

Processing dotnet/runtime#111088 (comment) command:

Command

-windows_intel

using System;
using System.Reflection;
using System.Reflection.Emit;
using BenchmarkDotNet.Attributes;

public class Bench
{
    Func<RuntimeMethodHandle> d = Init();

    static Func<RuntimeMethodHandle> Init()
    {
        DynamicMethod dm = new DynamicMethod("My", typeof(RuntimeMethodHandle), null, typeof(string).Module);

        MethodInfo randomMethod = typeof(object).GetMethod("ReferenceEquals");

        ILGenerator il = dm.GetILGenerator();
        il.Emit(OpCodes.Ldtoken, randomMethod);
        il.Emit(OpCodes.Ret);

        return dm.CreateDelegate<Func<RuntimeMethodHandle>>();
    }

    [Benchmark]
    public RuntimeMethodHandle LdToken() => d();
}

(EgorBot will reply in this issue)

@EgorBot
Copy link
Owner Author

EgorBot commented Jan 4, 2025

Benchmark results on windows_azure_cascadelake

BenchmarkDotNet v0.14.0, Windows 11 (10.0.26100.2314) (Hyper-V)
azure_cascadelake
  Job-HSQGMZ : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
  Job-NGMQWI : .NET 10.0.0 (42.42.42.42424), X64 RyuJIT AVX-512F+CD+BW+DQ+VL+VBMI
Method Job Toolchain Mean Error Ratio
LdToken Job-HSQGMZ \core_root_base\corerun.exe 30.73 ns 0.571 ns 1.00
LdToken Job-NGMQWI \core_root_diff\corerun.exe 12.73 ns 0.260 ns 0.41

BDN_Artifacts.zip

cc @jkotas (agent_logs.txt). EgorBot manual: link.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant