Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the real benefit of release mode for ASP.Net

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.

like image 669
Khanzor Avatar asked Nov 10 '09 22:11

Khanzor


People also ask

What is the use of release mode in Visual Studio?

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.

Is release build faster than debug?

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.

What is the difference between release and debug build?

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.


1 Answers

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

like image 131
Ryan Cook Avatar answered Nov 03 '22 00:11

Ryan Cook