Release versus Debug builds in C#

  • Thread starter Thread starter Jan
  • Start date Start date
J

Jan

Greetings,

I recently switched from a Debug version of code to a
release version of code. I checked to see that /optimize
was set for Release. After comparing the two versions of
code for execution speed, I must confess I didn't see much
improvement. Does anyone have an idea of how efficient
the optimization is for the C# compiler and what it does
(more specificially than size speed, etc, which is sited
in the help files)

Thanks very much!
 
The improvement should be in size of assembly which corelates to page faults
during runtime. Smaller assemblies cause less page faults (hard or soft) All
things considered. This is a general statement not an absolute, so nobody be
yelling at me.
 
The compiler really doesn't do a lot of optimizations, instead most of the
optimizations happen at runtime with the JIT. You can easily see the
differences in the compiler generated IL by using the SDK tool ildasm.exe
and then comparing the IL (think of it like java byte codes or a high-level
pseudo-assembly language). One common mistake when testing/checking
performance of 'optimized' code, is to run it under the debugger. When
running under the debugger, by default the JIT generates slow, more
debuggable code even if the optimize option was used. I know there's a way
to force it to generate optimizable code, but I can't find it at the moment.
 
Back
Top