C#/VB.NET Configuration - Do you know not to use debug compilation in production applications?
18/07/2013 6:50 AM by
Debug compilation considerably increases memory footprint since debug symbols are required to be loaded.
Additionally it will hit the performance because that will include the optional debug and trace statements in the output IL code.
In debug mode the compiler emits debug symbols for all variables and compiles the code as is. In release mode some optimizations are included:
- unused variables do not get compiled at all
- some loop variables are taken out of the loop by the compiler if they are proven to be invariants
- code written under #debug directive is not included etc.
The rest is up to the JIT.
C# debug vs release performance.
- Figure: Bad Example
- Figure: Good Example
We have a program called SSW Code Auditor to check for this rule.
Do you feel this rule needs an update?