发布/调试版本之间存在巨大的帧速率差异

发布于 2024-09-06 03:38:32 字数 156 浏览 1 评论 0原文

我正在开发一款 DirectX 游戏,我发现在发布版本期间我的平均帧速率为 170fps,但是在调试版本中我的帧速率约为 20fps。

我想知道发布和调试版本之间的巨大差异是否正常,特别是因为在调试中我没有输出任何痕迹?我知道调试和发布版本之间应该存在性能差距,但肯定不会这么大吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

睫毛溺水了 2024-09-13 03:38:32

像往常一样,这取决于(tm)。不,说真的:调试和发布性能之间的数量级差异听起来很合理。 (比相反更好;))

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

怀中猫帐中妖 2024-09-13 03:38:32

调试版本通常会禁用所有优化。许多库(包括 DirectX)还在调试模式下执行更多验证和详细诊断。

所以是的,性能上完全有可能有如此大的差异。

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.

若无相欠,怎会相见 2024-09-13 03:38:32

自然。调试版本具有未优化的代码,包含额外的元数据,以便可以在 pdb 文件中跟踪它们,以及各种其他吞噬你的 fps 的小精灵。许多测试代码也仅在调试环境中执行,如果您的代码处于紧密循环中(例如视频游戏渲染场景),您会注意到这一点。

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

dawn曙光 2024-09-13 03:38:32

是的,这完全正常。这种情况通常是由于使用像普通数据类型(即支持 +、-、* 等)和 ASSERT 一样的类类型(如 Matrix 和 Vector)引起的。

类类型导致如此缓慢的原因是因为在发布中没有内联代码,而在发布时它确实被内联了。这可能会导致巨大的速度差异,而且令人惊讶。

ASSERT 是检查事物安全性的额外工作。额外的工作意味着额外的处理时间,因此速度会变慢。

正如已经提到的,缺乏优化也无济于事。尽管在某种程度上,这反映在缺乏内联(这是一种优化)。

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

葵雨 2024-09-13 03:38:32

如果您想确定,始终可以选择进行一阶性能分析(使用您最喜欢的分析器)。是的,花时间优化调试版本通常不是一个好主意,但如果您发现性能与发布版本相差太远,那么花一些时间仍然值得。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文