android graphical rendering very slow Vs iPhone 2G & Palm Pre

124 views
Skip to first unread message

nige...@googlemail.com

unread,
Nov 8, 2010, 6:21:58 AM11/8/10
to phonegap
Hi

I have 3 devices I am testing my game on - iPhone 2G, HTC hero and
Palm Pre.

The graphical rendering on the Palm Pre and iPhone 2G is far superior
to Android. The game plays nicely on iphone and webos and poorly on
Android.

I expect the Palm Pre to be quickest and it is because it has a 600mhz
processor.

But my android (HTC Hero) has 528mhz processor and the iPhone 2G is
rumoured to only have 466mhz. Note I did a hell of alot of
optimization to get my game running quickly on the iPhone. My best tip
to optimize performance is code your graphical rendering in the
following order:
1. Program AI rules first
2. Then do drawing of objects to screen
3. Then play audio
If you code your functions in the above order it can be startling how
much difference it can make to game performance.

But my problem with Android still exists. I don't really understand
why the android version of my game is so slow. Here's some potential
ideas that I have:

1. Android limits resources to my app. The iPhone works on the premise
that only 1 app runs at a time. Android supports concurrent apps.
Therefore the iPhone could maybe, by default, dedicate far more
resources to my game than an Android would. Does anyway know if this
theory is valid and if so can I configure my app so that it can grab
more resource from the Android environment?

2. One of the levels in my game is quite simple and so has very few
game objects created at initialisation. It is notably faster than the
other levels. This observation is not true of iOS and webOS where
everything (to the human eye) runs at a fair clip. This is just an
observation I have made and maybe verifies my theory above.

3. My game is mainly DIV based with a touch of canvas. Maybe canvas
runs alot better on Android?

Note the game for all 3 environments has been set up with the same
loops/second and I switched audio off for the Android (it got a little
faster but still slow).

Anyone else there experienced performance bottle necks on Android? Any
ideas on how to get around them?

Maybe it's best I just release the game for snapdragon Androids?

Cheers

Nigel


nige...@googlemail.com

unread,
Nov 8, 2010, 9:23:13 AM11/8/10
to phonegap
Just another thought.

Is Android's webkit written in java since it's part of the sdk?

But android also has the ndk written in c or c++. One of the key
purposes of the ndk is to facilitate the development of certain
classes of app where speed is important ie games. Java is just not
good for games. It's too slow.

I suspect iOS uses webkit compiled from c or obj-c. And webos just
does fast js (but probably has webkit compiled from c).

So my question - has anyone tried/succeeded implementing a c version
of webkit via the ndk on android? Is this possible?

Do people think this would enhance android phonegap performance
dramatically?

Having said that, I would note that the Nokia N8 has poor performance
too and it has webkit compiled from c++ I would imagine. But maybe
it's processor sucks.

Nigel


On Nov 8, 11:21 am, "nigeke...@googlemail.com"

Nick McCloud

unread,
Nov 8, 2010, 10:20:46 AM11/8/10
to phonegap
I believe that Android's webkit is native and I know that many of it's
devices have low processing power & very little ram.

What are you testing on?

On Nov 8, 2:23 pm, "nigeke...@googlemail.com"

nige...@googlemail.com

unread,
Nov 8, 2010, 10:48:04 AM11/8/10
to phonegap
It's a HTC Hero with 528mhz processor and 288MB RAM.

My iphone 2G is rumoured to have 466mhz processor and 128MB RAM. Apple
don't officially publish this info but google it and you get the info.

So the HTC is much more powerful beast than my iphone but performance
is far worse with regard to my app.

Can anyone explain why this should be the case?

Björn Nilsson

unread,
Nov 8, 2010, 5:09:14 PM11/8/10
to phonegap
I have experienced the same thing as you, iOS and webOS has the upper
hand.

I have noticed there is a world of difference between Android 2.1 and
2.2. The JavaScript execution speed on 2.1 is just awful. I mean IE6
awful. I think they completely swithched the JS engine for 2.2.

There is also the issue of how fast drawing operations are, both for
canvas and the DOM.

I dont think its so meningful to compare how powerful the CPU is in
the different devices, its more to do with how the software is
implemented. For example iOS use the GPU to draw the graphics. Android
does everything on the CPU, as far as I know.

For my game I have implemented rendering for canvas, DOM and
webkitTransform (with translate3d), and were it on iOS is 30-60fps
depending on device, it is dog slow on Android. Im currently looking
for ways to make it faster. I had some hopes for webkitTransform but
it seems to be about the same as div left and top animation,
performance wise.

Anyone else doing animations on Android Browser that can share some
insights?

On Nov 8, 4:48 pm, "nigeke...@googlemail.com"

nige...@googlemail.com

unread,
Nov 9, 2010, 4:35:28 AM11/9/10
to phonegap
I had Orbium for webOS and then got it for Android to compare
performance.

Oribum is very playable on Android (alot quicker than my game) but the
webOS version is better.

There seems to be these little hiccups in the Android rendering.

Any idea how Orbium plays on a snapdragon 1GHZ processor?

I've put my game up on a public IP so will head down to the phone shop
and trial it on 1ghz android to see what happens.

Your point about the GPU is an interesting one. There must be an
android out there with a GPU.

webkit seems dodgy on android. its suppot for canvas seems better.

I'd love to know whether or not there's a way around this android
performance problem.

ps I installed 2.2 on my phone. My game didn't work on earlier
versions. 2.3 is rumoured to be out shortly so this may solve our
problem

nige...@googlemail.com

unread,
Nov 9, 2010, 5:05:08 AM11/9/10
to phonegap
Check out this http://www.youtube.com/watch?v=BEAWmSB1P8w

And http://androidandme.com/2010/07/news/galaxy-s-lineup-leads-the-pack-in-android-gpu-benchmarks/

It is rumoured that HTCs use the qualcomm chipset, have a GPU but HTC
didn't pay Qualcomm the license fees to use the GPU. It's there but
dormant. I read this in a forum.

The samsung galaxy and motorola droid utilise GPUs and so perform
better. See above.

So maybe I should release only for different models of android phone.
Is this possible in the android market?

On Nov 9, 9:35 am, "nigeke...@googlemail.com"

Björn Nilsson

unread,
Nov 9, 2010, 6:45:06 AM11/9/10
to phonegap
As far as I know you can only specifiy a minimum version of Android
API that is required, Not target specific devices. You also have to
support the cheaper devices that has a very low screen resolution
(ldpi). You can ofcourse write in the description, "only works on
these phones" or similar, but people might not read that.

I think most Android phones has a GPU, as there are OpenGL games that
work on them. The problem is the Android Browser rendering, and the UI
in general, is not using it.

Its good to hear you had decent results with Orbium on Android, I
guess performance varies some between phone models. But it is never
smooth in my experience.

On Nov 9, 11:05 am, "nigeke...@googlemail.com"
<nigeke...@googlemail.com> wrote:
> Check out thishttp://www.youtube.com/watch?v=BEAWmSB1P8w
>
> Andhttp://androidandme.com/2010/07/news/galaxy-s-lineup-leads-the-pack-i...

Luis Medel

unread,
Nov 10, 2010, 2:43:40 AM11/10/10
to phonegap
I'm currently writing a game using a mix of canvas drawing and css
transforms and, sadly, I've dropped Android support for a while
because its awful performance and the drawImage bug present in
versions prior to 2.2

I've tested canvas performance and it seems to be about the same in
Android and iOS. The difference come with css animations. Man, under
iOS these transforms are delightful! :)

2010/11/9 Björn Nilsson <bni...@gmail.com>:

> --
> You received this message because you are subscribed to the Google
> Groups "phonegap" group.
> To post to this group, send email to phon...@googlegroups.com
> To unsubscribe from this group, send email to
> phonegap+u...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/phonegap?hl=en?hl=en
>
> For more info on PhoneGap or to download the code go to www.phonegap.com
>

--
Luis Medel
http://www.luismedel.com

Reply all
Reply to author
Forward
0 new messages