I'm developing a game that is using box2d physics pretty intensively and my beta tester reported sloppy performance when there were a lot of objects on the screen. I was practically always hanging with the DEBUG version of the app and had pretty stable 60 fps all the time. After fiddling with practically all the build settings I noticed that in the DEBUG build mode a flag ONLY_ACTIVE_ARCH
was YES
whereas in RELEASE it was NO
. After building RELEASE version only for ARMv6 and installing it on an ARMv7 capable device, we had stable 60 fps. Trying to build for ARMv7 (Thumb) gave a sloppy (30 - 50% worse) performance again. There was also a slight performance hit visible in non physics simulated environments. The testing devices were iPod Touch 4, iPhone 4 and iPhone 3GS. Can you please share your opinions on why that could be so? I have no idea :)

- 64,284
- 20
- 132
- 217

- 1,973
- 17
- 18
2 Answers
I noticed the same issue. After some tests I recognized that the performance got much better if I set the following rendermode:
<renderMode>gpu</renderMode>
I tested this on a galaxy s2. Until now I don't know how the impact on other devices is...

- 444
- 2
- 6
- 23
First of all: always measure performance only in release builds. Debug builds include assertions, logging and possibly other things that can skew your performance results, usually to the worse.
If I get this right you're saying that ARMv6 code runs smooth (60 fps) on all devices, whereas building for ARMv7 with Thumb instructions enabled gives you "sloppy" performance. I take it that "30-50% worse" means about 30-45 fps for ARMv7 code on all 3 mentioned devices. It also sounds like you have no comparable test scenario, ie game starting with the same number of objects at the same positions to be able to accurately compare performance between devices. It is difficult to assess real performance differences if you manually reproduce a "a lot of objects" scene by playing the game.
Since you already have ARMv7 and thumb instructions enabled, you really should get good performance, especially on the 4th generation devices. You might want to try with thumb disabled and retest. You should also check the Optimization Level of your release build, it should be: Fastest, Smallest. In general check your build settings for any entry that affects only ARMv6 or ARMv7 (such entries are marked with an arrow to expand them).
You should also verify that your performance problem is actually related to physics. "A lot of objects" means there's also "a lot of sprites" on the screen. If they aren't sprite-batched the performance can drop a lot faster. If they are also partially transparent, rotated or scaled then performance without spritebatching will be even worse.

- 64,284
- 20
- 132
- 217
-
Thanks... If the game works at 60 fps constant in DEBUG, it should run the same or faster in RELEASE right, that's why I didn't test in release. I actually know exactly how many objects I have drawn / simulated at any given point. I have tried building the game with exactly the same build settings (Fastest, Smallest included) except for ARMv6 / ARMv7 (Thumb), for both DEBUG and RELEASE. Still it runs faster when I build it with ARMv6 and I don't see any obvious reason why. But you are right, I will make a test when I'm done with this project and expand on the question. – Marko Hlebar Oct 06 '11 at 09:22
-
Normally release builds run at least as fast or faster than debug builds. But there is the occasional odd case that makes it worthwhile to only test performance in release builds. After all, that's what your users will be playing with. – CodeSmile Oct 11 '11 at 13:19