Terrible Performance on Samsung Galaxy S, crashes on Tegra Devices

Good article and I do use some of your tips already. I’m not sure if action/arcade type of games will run too well on the older builds. I don’t have access to try it yet because I’m not a subscriber. When I am I will have a look at it.

I have tried an earlier build before and it force closed a lot and was way too slow to be used for the type of games I’m working on.

Build 484 seemed to of fixed many problems and runs good but has the downside of not being backwards compatible. I still think there’s room for improvement. Hopefully future builds of corona and faster android devices fix all these problems.

[import]uid: 38820 topic_id: 9133 reply_id: 33929[/import]

I just got a Samsung Epic (Galaxy S phone) and the performance is pretty terrible. Just a ton of lag when trying to run some (what I think to be) simple apps. [import]uid: 47373 topic_id: 9133 reply_id: 34001[/import]

If anyone has access to both a Samsung Galaxy S and another similarly specced Android phone, could you let us know what the performance difference is between them ?

I’ve read that the Samsung build of Froyo (2.2) is really bad but, without rooting my phone I can’t test a newer version ( I don’t want to root it - I’d rather see what a typical user would see with a similar device). [import]uid: 9428 topic_id: 9133 reply_id: 34002[/import]

???

Samsung Epic S uses ARM Cortex™-A8 CPU most likely running at 1G … But who knows what they did with it. Cortex A8 is single core. … Grrr… [import]uid: 24 topic_id: 9133 reply_id: 34004[/import]

Seems to be lagging whenever it goes to load a new image - at least that is one of the areas that are a problem.

Maybe I am just doing something wrong in my code but it seems to work fine on the simulator and on an iPhone 4. [import]uid: 47373 topic_id: 9133 reply_id: 34005[/import]

how big is the image? png? jpg?

what steps are you taking?

can you publish code?

c. [import]uid: 24 topic_id: 9133 reply_id: 34006[/import]

Can I just email it to you? Don’t need to embarrass myself by posting my first attempt at a corona app here :stuck_out_tongue: [import]uid: 47373 topic_id: 9133 reply_id: 34008[/import]

We are talking about the Samsung Galaxy S (I9000-GT).

FYI:

Samsung Galaxy S ships with a PowerVR SGX540 GPU
iPhone 4 ships with a PowerVR SGX535 GPU

iPhone 4 performance is WAY higher than the Galaxy S in CoronaSDK, and considering we are running native code on both devices, I believe the problem lies in Corona.

Regarding the posts about code quality, (the GIGO note especially), please refer to the code posted by myself, and another user in the thread (that removed all transition.to calls). The code is dead simple.

It also runs over 2X faster on a HTC Evo 4G, which has a weaker GPU as well.

If these devices can reach 40+FPS in full 3D applications (like GLBenchmark 2.0), but cannot draw 500 copies of a texture (lets say its two triangles (don’t see why it’d be more) per surface for newImage, we are looking at 1000 triangles) at 30FPS, it points to engine code rather than device hardware.

The SGX540 GPU has a fill rate of 20,000,000 untextured triangles a second. That should be enough :slight_smile:

[import]uid: 50524 topic_id: 9133 reply_id: 34007[/import]

Is there a way in Corona to spawn other threads? That way I could try to load the images before they are needed in a separate thread?

And yes, I agree the phone should be able to handle it. I am only trying to load a single new image at most every second. [import]uid: 47373 topic_id: 9133 reply_id: 34011[/import]

@Vostok: you ignore the most crucial factor and that are drivers.
Each device has the right to use own drivers and they unhappily do so too and from what I recall, samsung just throws in the reference driver, point, without investing any further work in getting it performing fine while Apple invests a lot into it as they realized that they could enter the mobile gaming market the big way. But even they had their lessons to learn. compare iOS 3.x vs 4.x on how many drawcalls you can push through at the same framerate - they went up by over 50% basically.

And the Android side still is learning, some much faster (Xperia Play crushes any other Snapdragon 2 device easily due to high efforts in optimizing it for gaming). Samsung is still in the early learning, their 2.1 fiasco has shown that among their performance problems they still have (the rooted images were worlds faster than the release 2.2.x, the benchmarks are catastrophal and die straight out vs the rooted images, …). HTC, LG and others are somewhere in the middle, better and worse than middle depending on the device and OS version.

But its really bad that Corona hits the wall that badly
@MrZorn: On Galaxy S + Android 2.1 thats expected. it has major problems handling data loading, without rooting + applying speedfix or using Kies to update to the official 2.2+ there is no hope at all aside of: stop loading images at runtime at all! Load the images as you enter new levels and never after. Only reuse the images you already have during the level [import]uid: 34188 topic_id: 9133 reply_id: 34016[/import]

@dreamora The phone is android 2.2 [import]uid: 47373 topic_id: 9133 reply_id: 34020[/import]

sure email me cicaza at anscamobile dotr com

as for Corona being slow. we perform really well on other devices. this seems to be an isolated issue. and we are looking into it.

let me repeat : we are looking into it

c. [import]uid: 24 topic_id: 9133 reply_id: 34022[/import]

@mrzorn: then you are already in a happier position than those on 2.1. it still is nowhere in the range of the speedfix rooted ROMs but its better than what you would have on 2.1 (the IO problems there are the root behind the phantom stutter of the whole device) [import]uid: 34188 topic_id: 9133 reply_id: 34023[/import]

corona caches images : if you load the same image twice : it knows so it fetches it from memory rather than from the drive

c [import]uid: 24 topic_id: 9133 reply_id: 34024[/import]

@carlos Emailed you a zip of my project - thanks for looking at it, hope you can help or that it will help with the next build(s). [import]uid: 47373 topic_id: 9133 reply_id: 34026[/import]

@carlos - you asked prior whether I was using jpg or png. I am currently only using pngs. Is there a preferred image format? [import]uid: 47373 topic_id: 9133 reply_id: 34098[/import]

I’m also having terrible performance issues with the Samsung Galaxy S, using Samsung’s 2.2 OS.

I also have a Motorola XOOM, (Honeycomb 3.0), runs beautifully on there.

I’ve disabled almost everything in my game - all my animations, almost all my listeners, and narrowed it down to the ragdoll code. I’ve made a test application, using the ragdoll code from here:

http://developer.anscamobile.com/forum/2010/10/29/new-corona-any-radgoll-examples

You’ll need gameUI.lua, set to 60fps to really see the difference.

Just touch the white square to spawn a new ragdoll.

Galaxy S:
1 and 2 ragdolls: 60fps
3 ragdolls: 30-40fps
4 ragdolls: 30fps

On the XOOM, I can spawn over 30 and fling them all over the screen and it still runs at 60fps. The extra core can’t be doing THAT much…

And yes, my frame rate counter is a little off, but it gives you the general idea…

[lua]

local physics = require (“physics”)
local gameUI = require(“gameUI”)

local m = {}
m.floor = math.floor
m.random = math.random

physics.start ()
physics.setGravity (0, 10)
–physics.setDrawMode (“hybrid”)

–> Create Walls
local leftWall = display.newRect (0, 0, 1, display.contentHeight)
local rightWall = display.newRect (display.contentWidth, 0, 1, display.contentHeight)
local ceiling = display.newRect (0, 0, display.contentWidth, 1)
local ground = display.newRect (0, display.contentHeight - 80, display.contentWidth, 80)

physics.addBody (leftWall, “static”, {bounce = 1.0, friction = 10})
physics.addBody (rightWall, “static”, {bounce = 1.0, friction = 10})
physics.addBody (ceiling, “static”, {bounce = 1.0, friction = 10})
physics.addBody (ground, “static”, {bounce = 1.0, friction = 10})

– Create Spawn Button
local spawnButton = display.newRect(display.contentWidth * 0.5, 30, 30, 30)
spawnButton:setFillColor(255,255,255)

function spawnButton:touch (event)
if (event.phase == “ended”) then
local tempRagDoll = newRagDoll (200,100,m.random(255),m.random(255),m.random(255))
end
end

spawnButton:addEventListener ( “touch”, spawnButton )

function newRagDoll(originX, originY, r, g, b)

–> Create Ragdoll Group

local spacing = 1
local scaling = 1 – this will work for sizes of objects, not sure about joints…

local ragdoll = display.newGroup ()

local head = display.newCircle( 0, 0, 5*scaling )
head.name = “head”
head.x = originX
head.y = originY
head:setFillColor (r, g, b)
ragdoll:insert (head)

local torsoA = display.newRect( 0, 0, 14*scaling, 10.5*scaling )
torsoA.name = “torsoA”
torsoA.x = originX
torsoA.y = originY + head.height
torsoA:setFillColor (r, g, b)
ragdoll:insert (torsoA)

local torsoC = display.newRect( 0, 0, 12*scaling, 16*scaling )
torsoC.name = “torsoC”
torsoC.x = originX
torsoC.y = torsoA.y + (torsoA.height * 0.5) + spacing + 2
torsoC:setFillColor (r, g, b)
ragdoll:insert (torsoC)

local pelvis = display.newRect( 0, 0, 10*scaling, 8*scaling )
pelvis.name = “pelvis”
pelvis.x = originX
pelvis.y = torsoC.y + (torsoC.height * 0.5) + spacing
pelvis:setFillColor (r, g, b)
ragdoll:insert (pelvis)

local leftLegA = display.newRect( 0, 0, 4*scaling, 20*scaling )
leftLegA.name = “leftLegA”
leftLegA.x = pelvis.x - ((pelvis.width - leftLegA.width) * 0.5)
leftLegA.y = pelvis.y + (leftLegA.height * 0.5) + spacing
leftLegA:setFillColor (r, g, b)
ragdoll:insert (leftLegA)

local rightLegA = display.newRect( 0, 0, 4*scaling, 20*scaling )
rightLegA.name = “rightLegA”
rightLegA.x = pelvis.x + ((pelvis.width - rightLegA.width) * 0.5)
rightLegA.y = pelvis.y + (rightLegA.height * 0.5) + spacing
rightLegA:setFillColor (r, g, b)
ragdoll:insert (rightLegA)

local leftArmA = display.newRect( 125, 70, 3.5*scaling, 20*scaling ) – check these x and y values
leftArmA.name = “leftArmA”
leftArmA.x = torsoA.x - (torsoA.width * 0.5) - 1 – check this last value
leftArmA.y = torsoA.y + (leftArmA.height * 0.5) - 2 – check this last value
leftArmA:setFillColor (r, g, b)
ragdoll:insert (leftArmA)

local rightArmA = display.newRect( 185, 70, 3.5*scaling, 20*scaling ) – check these x and y values
rightArmA.name = “rightArmA”
rightArmA.x = torsoA.x + (torsoA.width * 0.5) + 1 – check this last value
rightArmA.y = torsoA.y + (rightArmA.height * 0.5) - 2 – check this last value
rightArmA:setFillColor (r, g, b)
ragdoll:insert (rightArmA)

physics.addBody (head, {bounce = 0.0, friction = 1.0})
physics.addBody (torsoA, {bounce = 0.0, friction = 1.0})
physics.addBody (torsoC, {bounce = 0.0, friction = 1.0})
physics.addBody (pelvis, {bounce = 0.0, friction = 1.0})
physics.addBody (leftLegA, {bounce = 0.0, friction = 1.0})
physics.addBody (rightLegA, {bounce = 0.0, friction = 1.0})
physics.addBody (leftArmA, {bounce = 0.0, friction = 1.0})
physics.addBody (rightArmA, {bounce = 0.0, friction = 1.0})

local neckJoint = physics.newJoint ( “pivot”, head, torsoA, torsoA.x, torsoA.y)
neckJoint.isLimitEnabled = true
neckJoint:setRotationLimits ( -22.5, 22.5 )

local backboneA = physics.newJoint ( “pivot”, torsoA, torsoC, torsoC.x, torsoC.y )
backboneA.isLimitEnabled = true
backboneA:setRotationLimits ( -22.5, 22.5 )

local backboneC = physics.newJoint ( “pivot”, torsoC, pelvis, pelvis.x, pelvis.y )
backboneC.isLimitEnabled = true
backboneC:setRotationLimits ( -22.5, 22.5 )

local leftHip = physics.newJoint ( “pivot”, pelvis, leftLegA, leftLegA.x, pelvis.y )
leftHip.isLimitEnabled = true
leftHip:setRotationLimits ( -45, 90 )

local rightHip = physics.newJoint ( “pivot”, pelvis, rightLegA, rightLegA.x, pelvis.y )
rightHip.isLimitEnabled = true
rightHip:setRotationLimits ( -90, 45 )

local leftShoulder = physics.newJoint ( “pivot”, torsoA, leftArmA, leftArmA.x, torsoA.y )
leftShoulder.isLimitEnabled = true
leftShoulder:setRotationLimits ( 0, 180 )

local rightShoulder = physics.newJoint ( “pivot”, torsoA, rightArmA, rightArmA.x, torsoA.y )
rightShoulder.isLimitEnabled = true
rightShoulder:setRotationLimits ( -180, 0 )

function ragdoll:touch( event )
gameUI.dragBody( event )
return true
end

head:addEventListener ( “touch”, ragdoll )
torsoA:addEventListener ( “touch”, ragdoll )
torsoC:addEventListener ( “touch”, ragdoll )
pelvis:addEventListener ( “touch”, ragdoll )
leftLegA:addEventListener ( “touch”, ragdoll )
rightLegA:addEventListener ( “touch”, ragdoll )
leftArmA:addEventListener ( “touch”, ragdoll )
rightArmA:addEventListener ( “touch”, ragdoll )

ragdoll.head = head
ragdoll.torsoA = torsoA
ragdoll.torsoC = torsoC
ragdoll.pelvis = pelvis
ragdoll.leftLegA = leftLegA
ragdoll.rightLegA = rightLegA
ragdoll.leftArmA = leftArmA
ragdoll.rightArmA = rightArmA

return ragdoll
end

– Create frame rate counter text
function createFrameRateCounter ()

local frameRateText = display.newText(“test”, display.contentWidth - 50, 20, native.systemFont, 16*2)
frameRateText.xScale = 0.5; frameRateText.yScale = 0.5; – Makes text sharp on Retina Display
frameRateText:setTextColor(255,255,255)

local tPrevious = 0
local tCounter = 0
local framesCounted = 0

– Displays the current frame rate
local function frameRateCounter (event)
local tDelta = event.time - tPrevious
tPrevious = event.time
tCounter = tCounter + tDelta
framesCounted = framesCounted + 1

if (tCounter > 500) then
frameRate = m.floor((framesCounted / tCounter) * 1000)
frameRateText.text = frameRate
tCounter = 0
framesCounted = 0
end
end

Runtime:addEventListener( “enterFrame”, frameRateCounter );

return frameRateText
end

local frameRateText = createFrameRateCounter ()[/lua] [import]uid: 49372 topic_id: 9133 reply_id: 34112[/import]

@carlos

Thanks for the confirmation, that’s great news. Hopefully you’ll find some magic for Android devices in general while you’re at it :slight_smile: More performance is never a bad thing! [import]uid: 50524 topic_id: 9133 reply_id: 34119[/import]

Hi guys.

I did a quick test with the rag doll example above and the results are terrible on my droid 1 (2.2) I am not sure if is a fair test but I got only 30 fps to start with even so I setup it up with 60 fps! But if I tap one rag doll at the time, I got quickly down to 7 fps with about 30 dolls moving around on the ground. If I do more than 30 dolls thé rate goes down to 4 or 5 fps! (still I need to figure why the rate do not start at 60 fps)

That seems to be terrible for the Droid 1 since I have bunch of games with heavy graphics that run like butter. I think we should have some kind of standard speed test to evaluate the performance of Corona on Android.

This is very troublesome. I know that Corona is making a lot of progress on Android and obviously it is not entirely Corona’s fault since they are multiple Android devices flavors. But still, we should be able to expect some minimum performance.
Thanks for listening.

Mo.

Ps. Please do not get me wrong. I LOVE Corona! I cannot believe I did not know about it until few weeks ago. But as someone who do not own a Mac, android apps is the only apps I can develop at this time. So it is very disheartening to hear and experience all these performance issues. [import]uid: 49236 topic_id: 9133 reply_id: 34228[/import]

I ran the rag doll with setting of 60 fps.

Results for Captivate Galaxy S
model: SGH-I897

0 rag dolls 62 fps
1 rag dolls 55 fps
3 rag dolls 38-45 fps
4 rag dolls 32-37 fps
5 rag dolls 22-25 fps 5th doll falls in slow motion and if I move the dolls everything is slow motion.

When I set the frame rate to 30 fps I get the following results.

0 rag dolls 30 fps
4 rag dolls 30 fps
5 rag dolls 22-26 fps not slow motion but movement of rag dolls skips because of slow frame rate.

This is disappointing because the game I’m making runs fine now because I have 1 dynamic physics object which is the ball and 99 static physics objects bricks and paddle. It looks like now if I attempt to add any more dynamic physics objects to the breakout game it will slow down considerably. I’ll add a couple more balls to the game and see what happens.

Hopefully Carlos and the rest of the Ansca crew can find a solution to this problem.

I really like the ease of use of lua and corona. I thought ansca fixed the performance issues by targeting 2.2+ but I guess I was wrong.

I’m sure Carlos and his crew are hard at work and I can’t wait till these issues are fixed in the next builds. Since I don’t have an iphone or a mac I can only develop for android using windows. I’ll continue and finish my game and when the above issues have been fixed I’ll definitely become a subscriber. sorry for the long post guys.

Glenn
[import]uid: 38820 topic_id: 9133 reply_id: 34265[/import]