Android移动开发性能与可扩展性

发布于 2024-08-31 03:15:34 字数 97 浏览 1 评论 0原文

我正在android中开发一个游戏,我一直在考虑将游戏的许多元素(例如游戏对象)细分为单独的类和子类。但我知道对这些对象的方法调用会导致一些开销。提高性能更好还是提高可扩展性更好?

im developing a game in android, and i've been thinking about subdividing many of the elements of the game (e.g. game objects) into separate classes and sub-classes. but i know that method calls to these objects will cause some overhead. would it be better to improve performance or to improve extensibility?

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

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

发布评论

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

评论(3

锦上情书 2024-09-07 03:15:34

只有您才能回答这个问题 - 有些游戏需要最高的性能,而另一些游戏则变得非常复杂,以至于易于扩展是唯一的出路。

但请记住,您所指的“开销”可能非常小 - 几乎无穷小 - 并且不应该在您对任何初始版本的关注列表中占据很高的位置。

还要记住,以后提取性能总是更容易,但可扩展性却不能这么说。

最后,请注意,过早的性能调整经常会失败。很难预测性能瓶颈在哪里,现场测试更有可能产生良好的结果。

Only you can answer that question - some games require the utmost in performance, others become so complex that ease of extensibility is the only way to go.

Bear in mind though that the 'overhead' you're referring to is likely to be VERY small - nearly infinitesimal - and should not be high on your list of concerns for any initial release.

Remember too that it's always easier to extract performance later, the same can not be said of extensibility.

Finally, note that premature performance tweaks frequently fail. Ascertaining where the performance bottlenecks are can seldom be predicted, testing in situ is far more like to yield good results.

蓝颜夕 2024-09-07 03:15:34

您考虑过内联函数吗?这样您就可以保持代码的可扩展性和清晰性,理想情况下不会造成性能损失。

Have you considered inline functions? That way you may preserve extensibility and clearness of code, ideally without a performance loss.

若水般的淡然安静女子 2024-09-07 03:15:34

首先以最优雅的方式构建。

最后优化瓶颈,保持其余部分完好无损。

At first just build in the most elegant way.

At last optimize the bottlenecks leaving the rest intact.

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