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

Discussion in 'C++' started by zhouchengly@gmail.com, Nov 7, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertisements

  2. ralph Guest

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

    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.
     
    ralph, Nov 7, 2006
    #2
    1. Advertisements

  3. Rolf Magnus Guest

    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.
     
    Rolf Magnus, Nov 7, 2006
    #3
  4. <> wrote in message
    news:...
    :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
     
    Ivan Vecerina, Nov 7, 2006
    #4
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stefan Landgraf

    switching between release and debug version

    Stefan Landgraf, Oct 1, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    476
    Scott Allen
    Oct 1, 2004
  2. RonL
    Replies:
    0
    Views:
    928
  3. croeltgen
    Replies:
    1
    Views:
    632
    Andrew Thompson
    Oct 25, 2004
  4. Christine
    Replies:
    0
    Views:
    3,074
    Christine
    Aug 8, 2006
  5. Mr. SweatyFinger
    Replies:
    2
    Views:
    2,797
    Smokey Grindel
    Dec 2, 2006
  6. Replies:
    6
    Views:
    686
    Markus Grueneis
    Sep 10, 2006
  7. George2

    dumpbin with debug and release version

    George2, Nov 11, 2007, in forum: C Programming
    Replies:
    1
    Views:
    503
    santosh
    Nov 11, 2007
  8. Hans Stoessel
    Replies:
    4
    Views:
    1,569
    Hans Stoessel
    Apr 22, 2010
Loading...