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

why the efficiency between debug and release version differs so much(VS2005).

P: n/a
I test a stl sort function in vs2005 and find the efficiency of debug
to release version is about 1000:1, it suprise me and I'm curious what
cause it.

Nov 7 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
zh*********@gmail.com wrote:
I test a stl sort function in vs2005 and find the efficiency of debug
to release version is about 1000:1, it suprise me and I'm curious what
cause it.
Debug version contains additional debug code.
Release version is compiled with more compiler optimisations.

Nov 7 '06 #2

P: n/a
zh*********@gmail.com wrote:
I test a stl sort function in vs2005 and find the efficiency of debug
to release version is about 1000:1, it suprise me and I'm curious what
cause it.
Your question is off-topic here. This newsgroup is only about the C++
language, not any specific compilers or other programming utilities. It's
better to ask in a newsgroup about "vs2005".
Having that said, optimizations are probably disabled in debug mode. Some
optimizations make debugging a lot harder, so they are only enabled in
release mode.

Nov 7 '06 #3

P: n/a
<zh*********@gmail.comwrote in message
news:11**********************@k70g2000cwa.googlegr oups.com...
:I test a stl sort function in vs2005 and find the efficiency of debug
: to release version is about 1000:1, it suprise me and I'm curious what
: cause it.

In debug mode, some standard library implementations (including the
one provided with VS2005) go to great lengths in making rendundant
checks. For example, each container might internally be keeping
a list of all iterators that point into it. And whenever an operation
on the container could invalidate iterators, all iterators will be
marked as invalid, to be able to report such diagnostics. As a result,
some operations are slowed down by orders of magnitude.

Defining some macros may allow you to disable these features in
debug mode (as well). This would allow you to suppress this
library-caused performance penalty.

[ Note that VS2005 also has some (lighter) library checks enabled
in release builds as well by default. They can explicitly
be disabled as well -- check your documentation if you need this. ]

hth -Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <http://www.brainbench.com

Nov 7 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.