Reputation: 4982
I am experimenting with compiler performance. I have a very small piece of code, just a few floating point multiplications and additions. The code gets executed in a loop several million times. I am trying to compile the code in C++, c#, java, perl, python ... and then I run the result while measuring execution time.
I am quite dissatisfied with c# performance. My c# code is about 60% slower than equivalent C++ or java. I am sure, there must be a bug in my experiment. I would like to disassemble the resulting binary to learn why.
Is there such a option with MSIL code? Can the result of the c# JIT compiler be examined on the machine instruction level (x86 instructions, not MSIL instructions)?
Update
the code (u, v, g* are double; steps is integer)
stopwatch.Start();
for (int i = 0; i < steps; i++)
{
double uu = g11 * u + g12 * v;
v = g21 * u + g22 * v;
u = uu;
}
stopwatch.Stop();
Upvotes: 5
Views: 865
Reputation: 700152
Debug your code in Visual Studio (but compile in release mode), put a breakpoint in the loop, and open the Disassembly window (Debug -> Windows -> Disassembly) when the execution stops at the breakpoint.
Upvotes: 7