Open
Description
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)
Metadata
Metadata
Assignees
Labels
No labels