I know there are several questions asking the same question "Why should I use release mode". The problem I have with the answers is that they simply state, quite strongly, that you should always use release mode when a website is in production.
Why?
I understand that the code is optimised in the assemblies, but to what level? Is it going to optimise well written code? What kind of optimisations does it perform?
Are there any analyses regarding this? Is there anyway I can test the differences between debug and release?
I would really like someone who understands the why of this to at least provide a reference to some definitive reading material, as I have yet to find anything hard enough to satisfy my curiosity on this issue.
Visual Studio projects have separate release and debug configurations for your program. You build the debug version for debugging and the release version for the final release distribution. In debug configuration, your program compiles with full symbolic debug information and no optimization.
Debug Mode: In debug mode the application will be slow. Release Mode: In release mode the application will be faster. Debug Mode: In the debug mode code, which is under the debug, symbols will be executed. Release Mode: In release mode code, which is under the debug, symbols will not be executed.
Release vs Debug and it depends on what language you are using, Debug includes debugging information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. They each define different symbols that can be checked in your program, but they are language-specific macros.
Read this first: http://blogs.msdn.com/tess/archive/2006/04/13/575364.aspx, I just found it as part of answering this question, its a great article.
See this question: At what level C# compiler or JIT optimize the application code? for some info on general compiler optimizations.
Also, keep in mind that for a Asp.Net web application changing to release mode will compile the assemblies in release mode but for the page compilations you may also need to edit the debug attribute of the compilation element in your web.config.
<compilation defaultLanguage="c#" debug="true">
Web applications do strange things when debug=true is set, for example they do not honor request timeouts because it would interfere with debugging.
Here is a great article from the Gu on the subject: Don’t run production ASP.NET Applications with debug=”true” enabled
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With