I think I\'m observing the .NET JIT compiler not inlining or optimizing away calls to empty static methods that have no side effects, which is a bit surprising given some bespok
After digging a bit further, it turns out I can answer this question myself. As explained at http://blogs.msdn.com/b/vancem/archive/2006/02/20/535807.aspx , observing the disassembly of an optimized release build under the debugger will by default affect the JIT compiler.
Unchecking these
under VS > Tools > Debugging > General, will show the "real" JIT compilation result, which for the call to EmptyBody
in my Main
above is this:
004C2620 ret
Meaning that the call to EmptyBody
is completely removed, which is what was expected and the world is still a happy and somewhat predictable place to live in :)