开发者

HUGE framerate difference between release/debug builds

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 should be a performance gap between debug and release builds, just not this huge surely?


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 ;))


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.


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).


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).


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜