Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Release Mode vs Debug = "false"

I'm trying to find a definite explanation of what effect compiling in release mode has on a .Net 3.5 web application versus debug="false". So far it looks like setting debug="false" has the same effect and compiling in release mode has been depreciated but I can't find any firm evidence this is the case.

This question looked promising but seems to be answering what's the difference between debug and release builds rather than release mode and debug="true": What's the difference between compilation debug="false" and Release mode?

However it does link to this article: http://odetocode.com/blogs/scott/archive/2005/11/15/debug-and-release-builds-in-asp-net-2-0.aspx

"This new compilation model makes the Configuration Manager for a web site obsolete. The only option appearing in a Visual Studio 2005 web site “project” is a Debug configuration. Don’t fret – it means nothing. The web.config file now rules the school."

Now that is the closest I've had to an answer and it does seem to imply that release mode has been depreciated in favor of debug="false" but I can't find any confirmation of this on MSDN or any other source.

Any help would be greatly appreciated.

Update

Sorry; to clarify this is a "Web Application Project" I am referring to.

To rephrase my question slightly, if I have the following setting in web.config:

<compilation defaultLanguage="c#" debug="false">

What effect (if any) does release and debug mode compile have?

like image 212
Steve Green Avatar asked Jul 20 '10 23:07

Steve Green


People also ask

What is the difference between debug and release mode?

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 does debug false mean?

debug=true is for debugging during development. It creates debugging symbols used to provide metadata about the current executing code. debug=false is is for deployment to a production server. Please see the documentation...

How much faster is release than debug?

Release CRT makes the code faster in 2x times, given that inlining is disabled. Release CRT and inlining have major synergy, providing impressive x14 boost together when Runtime Checks are disabled. Default Debug build is x240 times slower than default Release build.

What is release mode?

Release mode controls what happens when the shutter is released. Single frame. The camera takes one photo each time the shutter-release button is pressed all the way down. Continuous low speed. The camera takes photos at a slow rate while the shutter-release button is pressed all the way down.


3 Answers

TL;DR = The more important thing is compilation debug="true|false". However, compiling in Debug has a minor effect on performance too.

The difference between Debug and Release (aside from defining the DEBUG constant or not) is the "Optimize code" flag, which is disabled in Debug and enabled in Release. (If you look at the project settings, Build tab.)

The "Optimize code" flag tells the language compiler to do some optimizations (like removing unused variables, and leaving out some debugging symbols) when producing the DLL. This is a relatively minor performance improvement (maybe a larger impact in C++ vs C#/VB) and a slight reduction in DLL memory usage, compared to when the flag is not set.

The compilation debug="true" flag tells the JIT compiler that this code should be hooked up for debugging. This reduces performance in several dimensions (load time, run time, memory, and resource loading) but enables debugging of running code.

If you want more detailed stack traces in production, then you can probably run a Debug build with compilation debug="false" with little performance difference. But I would test the performance for both to make sure you're not losing too much.

Credit belongs to this answer which links to this blog entry, and I later found this one, which contains all this info.

like image 69
Kasey Speakman Avatar answered Sep 18 '22 10:09

Kasey Speakman


You have to be careful of your word choice. There are "Web Application" and "Web Site" projects.

There is no "Release" configuration for "Web Site" projects. Web sites only use the debug setting in the compilation section of web.config. If you open a "Web Site", notice the only listed configuration in the "Configuration Manager" is "Debug". You can control compilation from the project's "MSBuild Options" property page or through the "Publish Web Site" dialog.

The configurations "Release" and "Debug" work as expected for "Web Application" projects.

like image 36
AMissico Avatar answered Sep 19 '22 10:09

AMissico


The idea behind 'Release' mode & 'Debug' mode is that, in debug mode, the compilation contains debug symbols which is useful for debugging but not for production, as it slows down the process.

However, 'Release' mode removes these debug symbols therefore the process runs fine without any issue.

Now, Microsoft has implemented the above model in web application projects while website project is slightly different. Hope this helps.

like image 26
SoftwareGeek Avatar answered Sep 20 '22 10:09

SoftwareGeek