Built-in functions in debug assembly (Visual C ++ 2008)

The core of the game I'm working with is too slow to build debugging and it's impossible to debug the game. One of the things I need is a compiler for creating small functions (especially in the Vector / Matrix and container classes). This may speed up the game in the debug build or not speed it up. Before profiling and trying to figure out the bottlenecks, I thought that I would try to do this first, as I would have to do minimal work, and the results could be promising.

So, is there a way to force the Visual C ++ compiler to embed functions in debug builds?

+7
source share
4 answers

Project parameters → C / C ++ → Optimization → Extension of the built-in function. Turn it on /Ob2 . Do this in your Debug configuration.

In the release, the extension of the built-in function is implied by other optimization settings, therefore, although by default all configurations say "Default" for this setting, the behavior is really different.

I believe that Debug assemblies should have built-in extension behavior just like release; there really is no reason not to do this.

http://msdn.microsoft.com/en-us/library/47238hez.aspx

+5
source

You can try __forceinline . Be sure to read about the debug build on this page (disable the /Ob0 option).

My suspicion is that this will not greatly change performance. Another thing to try if you don't want to add characters to the release build yet. It works well enough to debug many problems.

0
source

You are mixing two compiler options. /O affects optimization, including embedding. /ZI creates a PDB file for debugging. They can be installed independently.

It may be useful to clone the Debug configuration, and create a debug-optimized configuration using /O1 and /ZI .

0
source

DEBUG defined by Visual Studio when the project is compiled in debug mode, therefore:

 #ifdef DEBUG inline void fn() { #else void fn() { #endif 
-one
source

All Articles