How to make MSVC debug builds run faster

后端 未结 8 2100
日久生厌
日久生厌 2020-12-31 08:54

We have a large C++ application, which sometimes we need to run as a debug build in order to investigate bugs. The debug build is much much slower than the release build, t

8条回答
  •  自闭症患者
    2020-12-31 09:38

    Are you using MFC?

    In my experience, the main thing that can make a debug version slow is the class validation routines, which are usually disabled in release. If the data structure is at all tree-like, it can end up re-validating subtrees hundreds of times.

    Regardless, if it is, say, 10 times slower than the release build, that means it is spending 1/10 of its time doing what's necessary, and 9/10 doing something else. If, while you're waiting for it, you just hit the "pause" button and look at the call stack, chances are 9/10 that you will see exactly what the problem is.

    It's a quick & dirty, but effective way to find performance problems.

提交回复
热议问题