Hi!
I have a game running great on the multicore ios devices ( iphone4S+, iPad2+) but performance stinks on single core iPhone4. I’ve profiled and optimized and reduced draw calls to no end, and I’ve gotten the game to run at about 30 fps most of the time. However, every 10-20 frames, something will cause a frame spike that causes the profiler to show increased times for rendering, animation, physics and sometimes overhead. I’ve done the obvious thing of making sure nothing is happening in my frame ( i.e. the player is sitting still, no AI is moving, no camera is moving, nothing is being Instanced ) and I still see this. It’s not a garbage collection thing ( I don’t think ) because the profiler actually shows the times for specific tasks increasing that are not garbage collection.
Now, because things are fine on the dual cores, I’m guessing there’s some background thread running that’s causing context switches inside profiling blocks and making it look like random tasks are taking more time. So the question is, what’s the thread?
I tired profiling in Instruments and found two other significant threads besides the main- one references fmod, so I’m guessing it’s audio, and one references CoreMotion, so I’m guessing it’s for sampling the gyro ( since I have accelerometer frequency disabled in the Player settings). Those each seem to be using up about 5% of the CPU, for a total of 10% sucked up. However, according to Instruments, that seems to be a fairly consistent 10%, and wouldn’t cause the spikes I’m seeing ( I’ve seen forward opaque rendering shoot from 9ms one frame to over 100ms the next frame with absolutely nothing changing about the frame )
I’ve also run OpenGL ES Analysis in XCode, which claims I’m CPU limited and not GPU limited, so I don’t think it’s a matter of the command buffer filling up and then the CPU stalling while waiting for the GPU to clear it out.
I’m kinda going a little nuts here, wishing I had the symbols for Unity so I could get more accurate information out of the Instruments profiler. Anybody have any ideas what could be causing this? Or any ideas on how to rule out some mystery periodic background thread stealing time away from my main thread?
Thanks,
Josh