Any way to speed this up without losing any of the debugging functionality? Compared to debugging with clang on mac/linux the generated code is horribly slow.
-
Code is slower, but not that much IMHO. Could it be related with some code that shows up only with _DEBUG and _WIN32 defined? – ixe013 Dec 18 '14 at 18:26
-
Use the analyze tools to check where your code is spending its time. – rrirower Dec 18 '14 at 18:52
-
Not that much slower?? I'm seeing a difference in my 3d engine/game of over 30 FPS when running on debug. It's terrible. Nowhere near that slow on same debug settings on mac. I'll try some of the other suggestions here. – user2912108 Dec 18 '14 at 19:58
3 Answers
You could also try to disable debug heap by setting _NO_DEBUG_HEAP=1
See here more information about that:
http://ofekshilon.com/2014/09/20/accelerating-debug-runs-part-1-_no_debug_heap-2/

- 10,752
- 2
- 23
- 51
-
1I discovered this before posting. It made a HUGE difference. It made it go from blatantly unusable to mildly unusable. I gained alot more back by setting "basic runtime checks" to Default. This got me almost to the speed of clang's debug builds. – user2912108 Dec 21 '14 at 05:55
Find out why it's slow. This is how I find out. My off-the-cuff-probably-wrong guess is it could be in data validation. When you find out what it's doing you can probably turn it off by tweaking some compiler flags.
A way to do that is to make a release configuration, clone it, and then turn on symbol-retention and turn off compile-time optimization. This way you can debug it, but without turning on all the data structure validation, index checking, debug-new, etc .

- 1
- 1

- 40,059
- 14
- 91
- 135
-
I didn't see any option for "data validation" in the build settings. Is that safe to turn off (will it break the debugger being able to properly stop at breakpoints and spit out vars?) – user2912108 Dec 18 '14 at 20:00
-
1Yes, the debugger should work properly if you do the two things mentioned in release: turn on symbol-retention (Debug info: Yes) and turn off optimization (Optimization: None) – Nikolay Dec 19 '14 at 01:28
-
@user2912108: Nikolay is right. The relevant preprocessor symbol is `_DEBUG`. If it's defined, the VC include files generate code to do data validation and the debug version of `new`. You don't necessarily want all that, but you still want to be able to use the debugger. – Mike Dunlavey Dec 19 '14 at 01:41
This blog post has the full explanation of the OP's solution - referred to in his comment on Nikolay's answer: "I gained alot more back by setting "basic runtime checks" to Default. This got me almost to the speed of clang's debug builds."
This solution still works for the same problem in VS 2015.

- 3,088
- 2
- 34
- 41