views:

85

answers:

5

I'm working on a DirectX game and I'm finding that during release builds I'm getting 170fps average, however in debug builds I'm getting ~20fps.

I was wondering if this massive difference is normal between release and debug builds especially since in debug I don't have any traces being out put? I know there hsould be a performance gap between debug and release builds, just not this huge surely?

+3  A: 

As usual , It Depends (tm). No, seriously: an order of magnitude difference between debug and release performance sounds reasonable enough. (Better than the other way around ;))

Piskvor
+3  A: 

Debug builds normally have all optimizations disabled. Many libraries (including DirectX) also perform more validation and detailed diagnostics in debug mode.

So yes, it is perfectly possible to have such a big difference in performance.

jalf
+3  A: 

Naturally. Debug builds have unoptimized code, contain extra metadata so that they can be traced in the pdb files, and various other gremlins eating away at your fps. A lot of test code is also executed only in a debug environment, which you will notice if your code is in a tight loop (like, say a video game rendering scene).

Stefan Valianu
A: 

If you want to know for sure, there is always the option of doing a first order performance analysis (using your favorite profiler). Yes, it's usually not a good idea to spend time optimizing a debug build, but if you find the performance to be too far from the release build, it's still worth it spending some time on it.

Bahbar
+2  A: 

Yes it is entirely normal. Such cases are usually caused by the use of class types like Matrix and Vector that act like normal data types (ie support +, -, * etc) and ASSERTs.

The reason the class types cause such a slow down is because none of the code is inlined where in release it DOES get inlined. This can cause HUGE speed differences and surprisingly so.

ASSERTs are extra work to check the safety of things. Extra work means extra processing time and hence things slow down.

As already mentioend the lack of optimisation also doesn't help. Although, to some extent, that is reflected in the lack of inlining (Which is an optimisation).

Goz