Click here to Skip to main content
12,453,873 members (59,323 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Is there any differences between the Debug build and the Release build in regards to performance? Different IL generated?

Does the "Optimize code" option in the project change anything in Debug and Release?
Posted 10-Nov-11 20:21pm
Mehdi Gholam320.1K
Comments
SAKryukov 11-Nov-11 2:28am
   
Different options, no more. Everything is literally translated to some command line to CSC.EXE. But as to the result... You can disassemble to IL and see. :-) Interesting to know, so I vote 5 for the question.
--SA
Mehdi Gholam 11-Nov-11 2:42am
   
Interestingly sometimes debug builds are faster, and I have seen some NOP instructions in there.
SAKryukov 11-Nov-11 2:53am
   
Interesting. You could try to remove all NOPs from decompiled IL code and compile it back and than compare the speed. What if NOPs accelerate execution? :-)
--SA
Mehdi Gholam 11-Nov-11 3:04am
   
The only difference is debug uses more memory, in my test 592mb for debug, 586mb for release, the timings are the same for both.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

This link-[Debug vs. Release - The Best of Both Worlds][^] might helped you to get your answer.
or also look there-[Performance differences between debug and release builds][^] having similar question with some nice solution.
  Permalink  
v2
Comments
Mehdi Gholam 11-Nov-11 3:05am
   
Nice informative links, 5'ed
RaviRanjankr 11-Nov-11 3:17am
   
Thanks Mehdi :)
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

When you build the application in Release mode, the debug symbols are not baked into the assembly, so you cannot debug it using Visual Studio .NET or other source code debuggers. What's cool is that the code is also optimized during this build operation. And, all calls to Debug class methods in your code are disabled while calls to Trace class methods are left. (from here)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web01 | 2.8.160826.1 | Last Updated 11 Nov 2011
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100