Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Performance difference between a .NET assembly built in debug and release mode?

Tags:

.net

Some previous developers put some assemblies that were built in debug mode into production. Is it worth recompiling them in release mode and redeploying them? If there's just a 1-2% performance increase, I'd probably just leave them there. On the other hand, a 10-20% increase might change my mind.

like image 360
Jim Avatar asked May 19 '09 17:05

Jim


People also ask

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.

Is release mode faster than debug?

Lots of your code could be completely removed or rewritten in Release mode. The resulting executable will most likely not match up with your written code. Because of this release mode will run faster than debug mode due to the optimizations.

Why is Debug mode slower than release?

Because there are 400,000 loops in your code that need to be executed in debug, but these loops are optimized in release mode, so there is a big difference in the execution time. This difference will change with the number of cycles.

What is the difference between release mode and Debug mode?

By default, Debug includes debug information in the compiled files (allowing easy debugging) while Release usually has optimizations enabled. As far as conditional compilation goes, they each define different symbols that can be checked in your program, but they are language-specific macros.


1 Answers

I had this same question about a year ago because we were having major performance issues in production. As it was explained to me from MS Premier support the debug build versions include hooks for debugging which can result in about 1 - 10 % increase in memory consumption depending upon what the application does.

If you are not having problems then leave them alone, but if you are having problems with memory consumption then go ahead and recompile / deploy.

like image 97
Jeff Avatar answered Oct 07 '22 01:10

Jeff