The game engine I am working with is too slow in the debug build and is impossible to debug the game. One of the things I would like is for the compiler to inline small functions (especially in Vector/Matrix and container classes). This may or may not speed up the game in debug build. Before profiling heavily and trying to figure out bottlenecks I thought I would try this first as I would have to do minimal work and the results may be promising.
So, is there a way to get the Visual C++ compiler to inline functions in debug builds?
Project options -> C/C++ -> Optimization -> Inline Function Expansion. Turn this to
/Ob2. Also make sure that Debug Information Format (under C/C++ -> General) isn’t set to/ZI(set it to/Ziinstead if it is). Do this in your Debug configuration.In Release, inline function expansion is implied by other optimization settings, so even though by default all configurations say "Default" for the setting, the behavior is indeed different.
http://msdn.microsoft.com/en-us/library/47238hez.aspx
(original poster)
I believe Debug builds should have inline expansion behavior the same as release; there’s really no reason not to.
(editor)
The main reason to not do this is that functions that do get inlined won’t show up at all when stepping through code in the debugger, resulting in "invisible" code.