Tuesday, December 9, 2008

Compile for Thumb

From the iPhone OS Programming Guide:
"iPhones and iPod touches support two instruction sets, ARM and Thumb. Xcode uses Thumb instructions by default because using Thumb typically reduces code size by about 35 percent relative to ARM.
Applications that have extensive floating point code might perform better if they use ARM instructions rather than Thumb. You can turn off Thumb for your application by turning off the Compile for Thumb build setting."

So, are you using cocos2d + chipmunk ? Probably you will need to disable "compile for thumb".
How to:
  1. Open your XCode project
  2. Select 'Device - iPhone 2.x' as Active SDK
  3. For each Target do these:
  4. Go to: Project -> Edit Active Target
  5. Search for 'thumb'
  6. Disable 'Compile for Thumb'
That's all. Your game will perform much much much faster.
On the other hand, if you're not using Chipmunk, you might want to leave 'compile for thumb' enabled.









Chipmunk exampleThumb disabledThumb enabled
Example 160 FPS60 FPS
Example 230 FPS12~15 FPS
Example 315~20 FPS8~12 FPS
Example 460 FPS30 FPS
Example 512 FPS4 FPS
Example 660 FPS60 FPS
Example 760 FPS60 FPS


update: Added FPS comparisons

No comments: