By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,315 Members | 1,661 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,315 IT Pros & Developers. It's quick & easy.

"Optimised Debug" in Visual Studio 2003 ?

P: n/a
Sorry if this is the wrong forum...

Does anyone know what the difference is between a debug build and an
optimised debug build in Visual Studio 2003?
Nov 15 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Hi John,
debug build: will contain debug info, but code is not optimized
debug optimized build: same as above, but code is optimized

To understand the difference between the two, you might want to compile
the sample code I attached (sample.cs) with and without the optimization
turned on.

Then you can compare the IL and notice the differences (not a lot because
this is a very simple code, but it give you an idea). To generate the IL,
you
can you ildasm.exe (provided with VS 2003). You should be able to see that
the optimizer replaced the "if-else" statement with a "switch-case"
statement
(well, if you look carefully :-).

Another way to compare the differences is probably to step into the code
and bring up the "Disassembly" window...

Hope it helps!

-Matteo

--------------------
From: "John Smith" <JS****@Phoney.com>
Subject: "Optimised Debug" in Visual Studio 2003 ?
Date: Tue, 30 Sep 2003 10:19:23 -0400
Lines: 6

Sorry if this is the wrong forum...

Does anyone know what the difference is between a debug build and an
optimised debug build in Visual Studio 2003?

Nov 15 '05 #2

P: n/a
Yes but what is the need for optmized debug?

since debugger always incurs substancial overhead and the implied assumption
is that efficiency/optimization is necessarily not an issue. If you hold
this statement to be correct then what possible use could optimized debug
serve?

I guess I need a real world example of why you would want to run with this
option considering that if there is a problem in the assembly and you have
built a debug assembly to fish out the issue, you are definitely not
interested in optimizing since the release version will take care of that.

regards

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits/default.htm

"Matteo Taveggia [MSFT]" <bz***@online.microsoft.com> wrote in message
news:iy**************@cpmsftngxa06.phx.gbl...
Hi John,
debug build: will contain debug info, but code is not optimized
debug optimized build: same as above, but code is optimized

To understand the difference between the two, you might want to compile
the sample code I attached (sample.cs) with and without the optimization
turned on.

Then you can compare the IL and notice the differences (not a lot because
this is a very simple code, but it give you an idea). To generate the IL,
you
can you ildasm.exe (provided with VS 2003). You should be able to see that
the optimizer replaced the "if-else" statement with a "switch-case"
statement
(well, if you look carefully :-).

Another way to compare the differences is probably to step into the code
and bring up the "Disassembly" window...

Hope it helps!

-Matteo

--------------------
From: "John Smith" <JS****@Phoney.com>
Subject: "Optimised Debug" in Visual Studio 2003 ?
Date: Tue, 30 Sep 2003 10:19:23 -0400
Lines: 6

Sorry if this is the wrong forum...

Does anyone know what the difference is between a debug build and an
optimised debug build in Visual Studio 2003?

Nov 15 '05 #3

P: n/a
Alvin Bruney wrote:
Yes but what is the need for optmized debug?

since debugger always incurs substancial overhead and the implied assumption
is that efficiency/optimization is necessarily not an issue. If you hold
this statement to be correct then what possible use could optimized debug
serve?

I guess I need a real world example of why you would want to run with this
option considering that if there is a problem in the assembly and you have
built a debug assembly to fish out the issue, you are definitely not
interested in optimizing since the release version will take care of that.

regards


Two reasons that I can think off the top of my head:

1) you distribute optimized builds to customers, and you want
corresponding debug symbols so you can do post-mortem debugging for
problems they might encounter;

2) the dreaded (but fortunately rare) situation where the optimized
build behaves differently than the non-optimized.

--
mikeb

Nov 15 '05 #4

P: n/a
Yes that's true. I did that a lot in C++. But since I moved to the web I had
totally forgotten about it. I guess pushing code to a server instead of to a
client's desktop has screwed with my fundamentals.

--
-----------
Got TidBits?
Get it here: www.networkip.net/tidbits
"mikeb" <ma************@mailnull.com> wrote in message
news:#E**************@tk2msftngp13.phx.gbl...
Alvin Bruney wrote:
Yes but what is the need for optmized debug?

since debugger always incurs substancial overhead and the implied assumption is that efficiency/optimization is necessarily not an issue. If you hold
this statement to be correct then what possible use could optimized debug serve?

I guess I need a real world example of why you would want to run with this option considering that if there is a problem in the assembly and you have built a debug assembly to fish out the issue, you are definitely not
interested in optimizing since the release version will take care of that.
regards


Two reasons that I can think off the top of my head:

1) you distribute optimized builds to customers, and you want
corresponding debug symbols so you can do post-mortem debugging for
problems they might encounter;

2) the dreaded (but fortunately rare) situation where the optimized
build behaves differently than the non-optimized.

--
mikeb

Nov 15 '05 #5

P: n/a
hi,

take a look at the DebuggableAttribute
--
best regards

Peter Koen
-----------------------------------
MCAD, CAI/R, CAI/S, CASE/RS, CAT/RS
http://www.kema.at
Nov 15 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.