Android performance ? Low frame rate and flickering ?

Hello,

I’ve just downloaded the latest cocos2d-x 2.0.3, compiled the Win32 tests and I must say I’m truly impressed - excellent job !
The only thing I’m concerned about is the performance on Android devices - I’ve built the TestCpp project for Android and I’m quite surprised that none of the tests run smoothly (at constant 60fps) - not even the simplest ones.
Actually even with the initial srcolling table list (with the black screen where you choose the tests to run) the frame rate jumps randomly between 40-69(??) fps.
I tried on my Galaxy S3 and a Nexus 7 with quite similar results (N7 was a little faster).
Both of these devices can run pretty complex 3D games with lots of textures and lightning at a perfectly smooth 60fps, yet with cocos2d-x I can’t have a smooth scrolling menu with a few lines of text on a black background ?

What am I missing here ?

Thank you

Richard

Update: Just tried the iOS version. On my old iPad 1, most tests run at a perfectly smooth 60fps.


fps.jpg (51.3 KB)

1 Like

ok, I guess using CCLabelTTF to draw the FPS drop down the FPS itself. I will check that.

Thanks for your quick reply, but I’m not sure about the label - I’ve just built a simple project with only a background image and a few sprites (no fps label), and it really does run smoothly on Win32/iPhone/iPad, but I’m still not getting 60fps at any of my (tegra/quad-core) Android devices.
Does anyone else have this problem ? Don’t you people care ? :slight_smile:
Shouldn’t I tweak the GCC compiler options or something ?

Thank you

Richard

Hi Richard,

I’ve just this week started looking at using cocos2d-x for a project, and noticed this same behaviour on my GS3. My PC gives a consistent 60fps but my GS3 jumps erratically between 48\ and68 fps (though I would say the average is about 60).

I do wonder if it is simply a timing problem where the FPS is not being calculated accurately (perhaps due to CPU frequency adjustments or something)? I note that the demos do run smoothly.

Hello
I also noted that, while debugging, is often called the garbage collector(“GC_CONCURRENT freed” in logcat). I noticed this while running testcpp on a galaxy nexus, version of cocos2d-x 2.0.4! conversely with the 2.0.3 calls to GC did occur less frequently … You can confirm this? thanks
Patrizio

I also noticed this.

I read a blog that mentioned that the Thread.sleep in the onDrawFrame function of cocos2dxRenderer.java was sleeping too long.

I changed from (Cocos2dxRenderer.sAnimationInterval - interval) * 2 / … to (Cocos2dxRenderer.sAnimationInterval - interval) and its not as bad.

As this is a android specific file, it might explain why it only effects android.