Reputation: 1973
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 :)
Upvotes: 1
Views: 1576
Reputation: 444
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...
Upvotes: 2
Reputation: 64477
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.
Upvotes: 0