My current work in progress occasionally (and unpredictably) has short pauses of up to a second or two which I assume are the GC - correct me if this is a poor assumption. The actual memory usage and drawcalls are pretty low so I used logcat to profile the game… however, I don’t really know what I should be looking for in the resulting log file. What are some warning signs that I should keep an eye out for, and is there any easy way to narrow down where in the log my sudden pauses are?
Additionally, the pauses only seem to occur on the first playthrough, second time or more (even completely exiting and reloading the app) and everything is smooth. If I delete the app and reupload it, the first run has these odd performance issues again. Any ideas why?
The only thing I can think of is excessive use of PlayerPrefs as those are cleared when you uninstall the app completely. PlayerPrefs are backed by a Java object (which in turn is backed by an SQL database iirc); accessing it (especially writing/reading interleaved) is quite expensive operation and should not be done on a per-frame basis. If you see anything like
Hmm, so far I haven’t been using PlayerPrefs (or any form of persistence) whatsoever. I’m testing on a Droid 2 at the moment.
I’ll comb through and start looking for any excessive GC calls and make sure there aren’t any C# classes being instantiated excessively (per-frame or whatever). Still curious that the 2nd+ runthrough removes the problem entirely.