优化GC语言,任何想法? [英] Optimization of a GC language, any ideas?

查看:162
本文介绍了优化GC语言,任何想法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在优化方面,我是一个非常大的新手。在我正在开发的当前游戏中,我已经设法优化了一个功能,并且削减了大约0.5%的CPU负载,这就像我一直非常棒。

I'm a pretty big newbie when it comes to optimization. In the current game I'm working on I've managed to optimize a function and shave about 0.5% of its CPU load and that's about as 'awesome' as I've been.

我的情况如下:我使用名为ExEn的XNA包装器库在MonoTouch中开发了一个物理重型游戏,并尝试我可能会发现很难让游戏达到可玩的帧速率。 iPhone4(此时甚至不想考虑iPhone3GS)。

My situation is as follows: I've developed a physics heavy game in MonoTouch using an XNA wrapper library called ExEn and try as I might I've found it very hard to get the game to reach a playable framerate on an iPhone4 (don't even want to think about iPhone3GS at this point).

物理计算中的性能下降几乎肯定是物理计算,如果我将物理学关闭物理跳跃如果我禁用所有内容,渲染,输入,音频,并且在物理密集的情况下让物理性能在物理上徘徊在15fps左右,那么就会非常突出。

The performance degradation is almost certainly in the physics calculations, if I turn physics off the framerate jumps up sharply, if I disable everything, rendering, input, audio and just leave physics on performance hovers around 15fps during physics intensive situations.

我使用了工具来分析性能和这就是我得到的: http://i.imgur.com/FX25h.png 功能排出最多性能的是来自th e物理引擎(Farseer)或他们调用的ExEn XNA包装函数(特别是Vector2.Max,Vector2.Min)。

I used Instruments to profile the performance and this is what I got: http://i.imgur.com/FX25h.png The functions which drain the most performance are either from the physics engine (Farseer) or the ExEn XNA wrapper functions they call (notably Vector2.Max, Vector2.Min).

我查看了这些函数,我知道它在哪里可以通过引用将值传递给那些函数而不是值,以便覆盖它(这实际上是我能想到的唯一方法。这些函数非常简单,基本上等于这样的操作

I looked into those functions and I know wherever it can Farseer is passing values by reference into those functions rather than by value so that's that covered (and it's literally the only way I can think of. The functions are very simple themselves basically amounting to such operations as

return new Vector2(Max(v1.x, v2.x), Max(v1.y, v2.y)) 

基本上我觉得我被卡住了在我有限的能力和对代码优化的理解中,我不确定我的选择是什么,或者我是否有任何选择(也许我应该只是卷入胎位并哭?)。随着LLVM的开启和内置版本,我最多可能获得15fps。我确实设法通过降低物理精度来使游戏达到30fps但是这使得许多关卡无法在身体相互交叉并且自身崩溃时无法播放。

Basically I feel like I'm stuck and in my limited capacity and understanding of code optimizations I'm not sure what my options are or if I even have any options (maybe I should just curl into a fetal position and cry?). With LLVM turned on and built in release I'm getting maybe 15fps at best. I did manage to bring the game up to 30fps by lowering the physics precision but this makes many levels simply unplayable as bodies intersect one another and collapse in on themselves.

所以我的问题是,这是一个失败的原因还是我可以做些什么来加强表现?

So my question is, is this a lost cause or is there anything I can do to beef up performance?

推荐答案

首先,爱情你在Windows Phone 7上的游戏!

First of all, love your game on Windows Phone 7!

其次,我在你的探查器输出中看不到任何异常。我对Farseer引擎进行了一次快速而肮脏的性能分析(在.net中运行)并得出了类似的结果。几乎看起来你的减速速度与整个电路板成正比,可能是因为单声道本身。

Secondly, I don't see anything out of the ordinary in your profiler output. I did a quick and dirty performance analysis of the Farseer engine once (running in .net) and came up with similar results. It almost looks like you have a slowdown that is proportional across the board and may be due to mono itself.

这篇关于优化GC语言,任何想法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆