On Tue, Jul 12, 2011 at 12:31 PM, Indiefreaks.com <[email protected]> wrote: > .method family hidebysig virtual instance void Draw(class > [Microsoft.Xna.Framework.Game]Microsoft.Xna.Framework.GameTime > gameTime) cil managed > { > .maxstack 8 > L_0000: ldsfld class > [Indiefreaks.AOP.Profiler]Indiefreaks.AOP.Profiler.ProfilerAttribute > Indiefreaks.Commander.CommanderApplication::__profilerAttribute132 > L_0005: ldarg.0 > L_0006: call class [mscorlib]System.Reflection.MethodBase > [mscorlib]System.Reflection.MethodBase::GetCurrentMethod() > L_000b: castclass [mscorlib]System.Reflection.MethodInfo
Gotta love being lectured about performance of method calls (sigh) just to see this. For information, you can do: ldtoken drawMethodDefinition call MethodBase::GetMethodFromHandle(System.RuntimeMethodHandle) Bang! On my machine, calling GetCurrentMethod a million times takes 2.6s. Doing the GetMethodFromHandle trick a million times takes 0.5s. Here, I just saved you enough time to call a few methods. Jb -- -- mono-cecil
