cocos2d-x Performance Tests

Hi All,

I’m new to both cocos2d and cocos2d-x (and C++, used c a looonnng time ago so lots to learn again :)). I’ve been setting up and playing with both cocos2d & cocos2d-x and thought I’d try running the ‘performance tests’ of both frameworks on my iPhone 4 and was expecting similar results but that doesn’t seem to be the case.

I’m using cocos2d-2.1beta3-x-2.1.0 & cocos2d-iphone-2.0 for the comparison. For cocos2d-x I’m using this project :-

/samples/TestCpp/proj.ios/TestCpp.xcodeproj

… and launching the performance tests from the menu in the app thats built. For cocos2d I’m using :-

/tests/PerformanceTests/cocos2d-ios-PerformanceTests.xcodeproj

I’ve run the ‘PerformanceSpriteTest’ for both frameworks and have the following test set & results :-

A (1)position - 250 nodes

cocos2d-2.1beta3-x-2.1.0 - 23.2 FPS
cocos2d-iphone-2.0 - 60.0 FPS

I noticed that the cocos2d-iphone-2.0 project was set for release and changed this back to debug to try and makes things ‘fair’ but the results are the same. Could somebody explain if this is normal behaviour and if not what sort of things would I need to do so I can make a fair comparison please ?

Awesome work by the way, been reading up on cocos2d and translating over quite easily even with my tiny brain :slight_smile:

Pete

Hi Again,

Thought I would try out the cocos2d-iphone-2.1-beta4 release as its closer to the beta3 the current packaged cocos2d-x build is based on. Still see the same behaviour unfortunately. Any help is much appreciated.

Thanks

Pete

…ok, feel a bit sheepish but worked it out FINALLY. I looked in a little more detail at the cocos2d code and noticed they don’t enable retina support via ‘enableRetinaDisplay’. The tests as I understand have been running in ‘scaled mode’ on my iPhone 4? Switched this on (enableRetinaDisplay) and sure enough things slow down to how cocos2d-x is performing. To recreate you’ll have to add the ‘hd’ assets for the tests or else you’ll end up with tiny sprites like I did for a while :wink:

For cocos2d-x I believe the retina display is enabled by default on devices that have it as per :-

http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Multi_resolution_support

‘On iOS, if the device supports retina display, we enable it by default.’

Mystery solved, I think. I’m very new to everything so if anybody has done anything similar and can just ‘nod’ in my general direction I’ll consider this case closed :slight_smile:

Thanks all.

Pete

You should use the release (not the debug version) for performance comparison.

Many thanks for your reply

Yes I had planned to get to that but with both projects set to use the debug via their XCode schemes I just wanted to see how the compared at this point. After I worked out about the retina display both cocos2d & cocos2d-x were showing pretty much identical FPS which is great to see :slight_smile:

I did spot that the release build has some optimisations switched on so I assume the performance will improve even more. What I was really trying to see what how cocos2d-x performed on iOS vs cocos2d, so far, so good. I learn’t some more about the build process as well :wink:

Pete