This project is read-only.

Random performance inside Visual Studio 2013


I made a test project in which I have an animation and FPS textbox using FW1FontWrapper. I have noticed that sometimes the FPS drops randomly to between 100 - 900 FPS instead of the usual 3000 FPS inside Visual Studio. This problem does not occur when I run the executable outside Visual Studio. The only call I make during my rendering loop is FW1FontWrapper DrawString() and the issue is resolved if I comment out this call:
            family.c_str(), // Family
Any idea what causes this problem? Using Visual Studio 2013 on Windows 8.1.


ErikRufelt wrote Nov 9, 2013 at 11:11 AM

Probably because of DirectWrite memory allocations, as they are replaced with debug versions when the debugger is attached. Try profiling it with the debugger running, which should if so show most time inside DirectWrite.

redplusplus wrote Nov 10, 2013 at 10:51 PM

Thanks for the fast reply! I ran the profiler from VS on my program and indeed, it seems I'm most of the time in DWriteTextLayout::Draw. However, frame rate was again normal when running with the profiler. Is this because VS doesn't attach a debugger when profiling?

ErikRufelt wrote Nov 10, 2013 at 11:25 PM

It probably skips the debugger if you use the Visual Studio profiler.

Someone else had this issue a while ago and he linked to this:
Go into Visual Studio property pages, and Debugging, and there's an Environment field where you can add _NO_DEBUG_HEAP=1 and the issue goes away.
(It might make it harder for the debugger to catch memory errors in a debugged app).

redplusplus wrote Nov 11, 2013 at 8:28 PM

Thanks! You were right; this solved the problem.