Upcoming SlideShare
×

# Cocos2d Performance Tips

2,990 views

Published on

cocos2dパフォーマンスチューニングの翻訳記事

Published in: Technology, Travel
1 Comment
5 Likes
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No

Are you sure you want to  Yes  No
Views
Total views
2,990
On SlideShare
0
From Embeds
0
Number of Embeds
1,312
Actions
Shares
0
11
1
Likes
5
Embeds 0
No embeds

No notes for slide
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• \n
• ### Cocos2d Performance Tips

1. 1. cocos2d performance tips
2. 2. 1. nonatomic !!@property(nonatomic,assign) ﬂoat altitude;
3. 3. 2. NSMutableArray NSArray CCArray enumerator for ( CellObject *object in objects ) { ... }
4. 4. cocos2d ( 0.9.x )CC_ARRAY_FOREACHCellObject *object;CC_ARRAY_FOREACH(objects,object) { ...}
5. 5. forfor ( int i = 0;i < self.numObjects; i++ ) {... hoge[i]} indexOfObject
6. 6. 3. ﬂoat count length
7. 7. 4. ﬂoat double ﬂoat 32bit double 64bit 100
8. 8. 5.break
9. 9. 6. tips2 (x1,y1),(x2,y2)
10. 10. ﬂoat xd = endpoint.x - startpoint.x;ﬂoat yd = endpoint.y - endpoint.y;ﬂoat comparedist = 100 * 100;distance = xd * xd + yd * yd;if (distance > comparedist) {...}
11. 11. sqrthttp://en.wikipedia.org/wiki/Fast_inverse_square_root ﬂoat fast_sqrt(ﬂoat number) { long i; ﬂoat x, y; const ﬂoat f = 1.5f; x = number * 0.5f; y = number; i = *(long*) &y; i = 0x5f3759df - ( i >> 1 ); y = *(ﬂoat*) &i; y = y * ( f - ( x * y * y ) ); y = y * ( f - ( x * y * y ) ); return number * y; }
12. 12. http://iphonedevelopment.blogspot.com/2009/03/speed-with- catch.html iPhone InvSqrt Normalize
13. 13. 7.
14. 14. RELEASE
15. 15. Challenge optimizing your code!!