I kind of already know the answer to this from other platforms, but i've just recently been trying to optimise my project which had started to get very slow on my original iPhone. Developing on a 3GS can definitely hide things from you.
Anyways, a good chunk of this performance hit has something to do with my physics setup, i think i've got it about as optimised as possible now.
However i was left with a general amount of profiled mono scripts update.. 4-6% (of a frame i presume). Even when it was doing what I really expected to be nothing.
In the end i selectively removed functionality and went through the tedious rebuilding on the much slower older phone.
Finally figuring out that some of my debug functions were actually very expensive, even though their function bodies were disabled on a #define.
Basically what transpires is that just doing string ops like
Debug.Log("pos = " + transform.position);
can add a real significant percentage on the update, along with a corresponding decrease in framerate, and crucially a big increase in mono memory usage fluctuation. Large amounts of which seems to perhaps lead to more garbage collection and frame spikes.
Anyways, I just wanted to know if anyone had spotted this and had any tips for improvements. I've already disabled a lot of my debugging logs and other outputs. But i think i need to really look into a better way of removing them all on-mass, in absence of global #defines or C#'s ability to completely remove members on a #define. I'd hope the latter would remove any calculations on the calling side as well.
Anyways, it seems strings == very bad!
asked Feb 24 '10 at 11:22 PM
A few things, accessing the transform using
(and of course us myTransform instead of transform everywhere in the class)
Considder having a
Whenever doing things that are for debug purposes only, yes the compiler will compile const expressions away if they're false.
answered Feb 25 '10 at 01:59 AM