Android Performance is too low

Hi,

In my current game, the iOS version is very stable (always 60fps-50fps more or less), but when I execute the game in Android the frame rate is about 30fps… I do not understand why it is happening because that frame rate is even when in the screen only there are sprites without movement and no more threads are executing…

Do anyone knows the reason of that?

I tested in a Galaxy Tab 2 10,1" and in a Sony Ericsson Neo V, both of them with the power saving option disabled… The cocos2d-x version is cocos2d-2.0-x-2.0.4.

Thank you!

hi,

same issue for my android device tab2 and note2 fps too low for ios devices its 60fps. for android device it goes to 10 - 15 fps

thankq

same here. I’m using Samsung S3 with cocos2d-2.1.3.
Game is running 60fps on ipad 2. Why so slow on high end android

I don’t think there is any problem with cocos on android, is probably your code :slight_smile:

when you are used to iOS, with few devices, all them high end, you have almost no performance problems, but Android is “the real world”, you have to be more careful there.

try to profile your code and see where is the bottleneck, with the provided information nobody can help you

Hola Jesús,

I doubt the low performance was due of our code, as I said in my first post, when I have only a layer with an image as a background in the scene the frame rate is also 30fps (it only happens in my Galaxy Tab 2, I have tried the game in a Xperia Neo V and it has a frame rate of 50-55 fps, I guess Galaxy Tab 2 has better features than Neo V so I do not understand why the performance is worse)…

I do not know why this is happening, if someone has solved any problem with performance, please, comment here and we can use those advice to solve our problems.

Thank you!

I insist:
profile your code

How do you recommend to profile the code?

Emilio Exposito wrote:

How do you recommend to profile the code?
Easiest way is “profile” action in XCode. Also configure profiler to hide Objective-C/unknown functions and show execution time per function, not per thread.

If CCNode::draw takes less than 70-80% of total time, something wrong with your code.

It depends on the hardware you are using. Especially android tablest are quite slow when it comes drawing a lot on the screen. The reason for this is overdraw most of the time. Also tablets often have a much larger screen resolution and still have the same (or only slightly upgraded) phone gpu’s. This is especially true for the first and second generation android tablets (Moto Xoom)

Another issue is that actually cocos2d does not help to utilize the gpu quite well. I know this from Adreno gpu’s (found in Qualcomm SoCs) that they have a fast z-discard feature. That means the hardware can detect if an object will not be visible due to z-buffer issues quite early in the pipeline. However cocos2d draws everything from back to front (it must do so, because of transparency). That means EVERY pixel you draw on the sceen, must be drawn by the gpu (i.e. every object needs transform, lighting, textureing etc…) iOS uses PowerVR chips, which do some z-sorting by themselves and also split up the screen into several tiles, which may allow for faster/parrallel processing.

Another reason for having low FPS might also be the display of the device. Your app is bound to the vsync of the device, if the display is capped at 30fps (I know this is true for the Sony Xperia X10) then you will never get more fps than that.
It may also depend on how the swapBuffers() call is implemented on the device. It might be implemented in a way that it blocks until you get to the next vsync. That is if your screen runs at 60Hz but you miss the vsync, swapBuffers might block untit the next vsync, which will result in a frame rate of only 30fps.

I would not recommend profiling on XCode as it probably won’t help you that much.
In general I start taking the execution times of CCActionManager::tick and CCScheduler::tick (the calls can be found in the CCDirector main loop). This is considerered the “game code”
Next I take execution times of the visit/draw calls. This is considered the “deawing code”
Then I also take the execution time of the swapBuffers call.

It helps a lot if you render as few objects as possible. And also having as few objects as possible in the scene graph.
For example if I draw a map, I split it up into several smaller chunks that I can clip away quite easy (Including all the objects that are within that chunk).
Also you should make sure that objects that are faded out will be either removed from the scene graph or will be made at least invisible. If a sprites opacity is zero it will still be draw. It depends on the hardware how efficient the can discard such objects.

1 Like

Check this also, helped me with some GPU:s http://www.cocos2d-x.org/boards/6/topics/14871

-Teemu

Check you don’t have “Power Saving” turned on, see the notification menu or your settings on your phone/tablet. If it is turned on all apps are limited to 30fps.

Try my solution:


It will works.

hey,

I recently opened a topic with the same issue

I tried you solution. but it just gives me a white screen if i use camera. Are there any other solutions?

thanks

I edited my post , becuase i gave some white screen too.
but now all is fine :slight_smile:
can u check my link again?

and check below too.
you may have to set different value, because your device is different.