Visual Studio can't debug performance bottleneck

Started by
4 comments, last by simpler 11 years, 6 months ago
I'm currently working on adding a GUI to a project and I'm having some problems with the FPS when rendering it. I'm having a hard time finding the bottleneck due to these circumstances:

  • When I run in debug mode the fps drops to around 14 when the GUI gets displayed. The thing is when I run the 'Performance Analyzis' tool to find the bottleneck the fps only goes down to around 140
  • When I run in release mode the fps also drops to around 14, but when I run the generated .exe file seperately the fps stays at 500


I thought that when running the analyzer things go slower but in this case the program runs 10x faster. Doesn't the analyzer use the exact same settings as when running in normal debug mode? And how can there be such a big difference between running the .exe file and running in release mode?

Im using GWEN as GUI library and a custom DirectX 11 renderer for it. To draw fonts I use FW1FontWrapper. Also I'm using Visual Studio 11 Beta.

Does anyone recognize this behavior?
Advertisement

big difference between running the .exe file and running in release mode?

Edit: Do you start the release mode pressing F5 ? Then you start your application with VS hooked up in debug mode.
When this happens, as far as I know, VS does some time consuming memory checking, even in release mode.

To clear it up:
compile in debug mode: disable optimization, add some debug code to your compiled code
compile in release mode: enable optimizations
F5: start VS in debug mode, it will hook up and check your application
Ctrl+F5: start your application without hooking up
Thanks for the fast answer! Yes I start the release mode with F5. I tried with Ctrl+F5 and got the same result as running the .exe file, that explains it.

I also tried starting the debug mode with Ctrl+F5 and got the same performance as running the performance analyzer. It seems like the analyzer runs without VS hooked up, is there any way to run it with VS hooked?
This is actually a Windows internal thing, not VC specifically. If a process starts up with a debugger attached then the Windows heap manager will put itself into debug mode.

To work around it, start your app without debugging (ctrl-F5) and then attach VC to the process after it starts.
-Mike
You can also set the _NO_DEBUG_HEAP environment variable to a non-zero value to stop it from occuring. You used to be able to set it from the Environment part of Project Properties->Configuration->Debugging but that was in VS2008, it may have changed in more recent versions.
Setting _NO_DEBUG_HEAP to a non-zero value did the trick! But I guess that by doing that I miss some important debug information?

This topic is closed to new replies.

Advertisement