- Home /
Random functions spiking in profiler on iPhone 4
I'm building a game for iPhone 4 and I'm trying to reach a consistent 60 fps. The main issue I'm having is that seemingly random functions are spiking. They'd normally take a millisecond or sometimes next to no time at all but occasionally those same functions take 10-20 milliseconds. The spikes seem to happen about 4 times a second and it is never consistent as to which functions take a long time.
Is there something I am unaware of like say if my Object count is to high will the iPhone need to page memory or something like that? I'm running out of ideas as to why this is happening.
Any suggestions would be appreciated. Thanks.
Answer by Antony-Blackett · Jun 11, 2011 at 10:21 PM
This turned out to be the sound thread staving the main thread of cpu. This doesn't show up in the profiler cpu graph which is a shame. It can be found in the audio section of the profiler however.
My sounds were set to be compressed in memory so the cpu had to use time to decompress them as they were playing. I set the sounds to be decompressed on load and the cpu spikes vanished.
Hope this helps others working on iPhone.
Your answer
Follow this Question
Related Questions
Is iOS hardware always locked at 60hz? 1 Answer
iOS - Build & Run not Working? [Profiler] 1 Answer
Very Bad Performance on Android 3 Answers
IOS FPS issue 1 Answer
Batching instances of same model with same material... doesn't work 1 Answer