Visual Studio应用程序运行极端慢调试

Visual Studio应用程序运行极端慢调试

问题描述:

我有一个原生的c ++程序,当使用Debug(F5)启动时运行速度> 20倍,但在使用无调试启动(Ctrl + F5)时以正常速度运行。

I have a native c++ program which runs > 20 times slower when started with Debug (F5) but runs at normal speed when using start without debug (Ctrl+F5).

无论我使用debug还是release build都没关系。

It does not matter whether I use a debug or release build. Also if I use Windbg the program is a magnitude slower.

有没有一些设置我选择了错误或什么?

Is there some setting I did choose wrong or something?

将_NO_DEBUG_HEAP环境变量设置为1(如 http://preshing.com/20110717/the-windows-heap-is-slow-when-launched-from-the-debugger

Set the _NO_DEBUG_HEAP environment variable to 1 (as seen on http://preshing.com/20110717/the-windows-heap-is-slow-when-launched-from-the-debugger )

这也可以从Visual里面完成。

This can be done from inside Visual, too.

现在这只是一个解决方法,我很想知道如何重构遇到这种问题的程序。你有很多std :: map的,shared_ptr,或任何其他大的indirections任何机会?

Now this is just a workaround, I'm curious to know how to refactor a program which suffers from this kind of problem. Do you have many std::map's, shared_ptr, or any other big indirections by any chance ?