massive performance discrepancy between corona simulator vs actual device

I am very disappointed with the performance of my app and I am not sure how to go about solving this,
here is the screencast of my app in action: (left simulator is corona, right simulator is xcode, let it buffer, it’s quite slow) http://screencast.com/t/2OzMHFfqCj

That screencast it’s not even the final version, there are a bunch of animations that I have to disable to squeeze some FPS out, it already makes the game feel really bland. I am using 20x25 tiles displayed using sprite through Lime version 0.8 and I am getting 30fps using corona simulator but 3-4 fps in both xcode simulator and actual device (after several hours mucking around some provisioning stuff, SO MUCH HATE).

Is it too big? but 5 megabytes shouldn’t be that big? It’s even reporting really low in the actual device’s texture memory.
Is it memory extensive? I have an enterframe, I disabled that and redeploy, i am not getting any performance gain.
I have made sure that I am optimizing my lua, local vs global, table.insert vs #table + 1 for insertion, etc
I am using texturepacker for my png-24 sprites and displaying them using sprite library via SpriteGrabber

What should I do? I need a major help guys…
[import]uid: 11334 topic_id: 4700 reply_id: 304700[/import]

PS: I haven’t even put audio in yet…
( I am still not able to edit the thread, I could but I think I will be moving the thread to either General forum/ Corona SDK forum) [import]uid: 11334 topic_id: 4700 reply_id: 14882[/import]

I have no experience with Lime, however the first thing I would try is to find a way to automatically set everything that goes out of screen to non-visible:

object.isVisible=false. [import]uid: 7356 topic_id: 4700 reply_id: 14889[/import]

I’d probably stop optimizing at this point and wait until they get this bug sorted out:

https://developer.anscamobile.com/forum/2010/12/21/performance-nastiness-framerate-framedrops-lag

[import]uid: 4454 topic_id: 4700 reply_id: 14897[/import]

@oz-machine
I am hoping that is the same bug so the next release will fix it, although I doubt that it is the same, I haven’t even put any audio in and it’s already going this slow… [import]uid: 11334 topic_id: 4700 reply_id: 14898[/import]

newbie,

Well, that’s the thing. It happens whether there’s audio or not. Apparently, a recurring function relating to the audio engine, designed for maintenance, is draining cpu. It’s only noticeable when run on iOS, like the actual simulator or device. Hopefully, it’s a simple fix. [import]uid: 4454 topic_id: 4700 reply_id: 14899[/import]

@oz-machine
ho… thank you for the hint oz-machine, could someone from ansca confirm this? I am willing to send my codebase and everything. [import]uid: 11334 topic_id: 4700 reply_id: 14900[/import]

How big is your map? [import]uid: 6645 topic_id: 4700 reply_id: 14905[/import]

@jmp909
it’s 20x25 tiles of 32x16 pixel [import]uid: 11334 topic_id: 4700 reply_id: 14906[/import]

deployed to Android HTC Evo android 2.2 and it’s exhibiting the same behavior… [import]uid: 11334 topic_id: 4700 reply_id: 14913[/import]

Hi, I know that Lime itself does cause huge performance problems on the hardware which is the main reason I haven’t actually released it yet however it looks like your problem might be a combination of Lime and the Audio bug. I’m hoping that the performance issues I am having with Lime are caused by something like that Audio bug that we just haven’t discovered yet. [import]uid: 5833 topic_id: 4700 reply_id: 14921[/import]

@newbie101

Hi,
are you calling “collectgarbage()” every frame !?

Your memory looks way too “clean” in the Corona version.
[import]uid: 5750 topic_id: 4700 reply_id: 14999[/import]

@erpy:
no I don’t, do I need to?
What do you mean by too clean? [import]uid: 11334 topic_id: 4700 reply_id: 15026[/import]

Well, the other version shows ~5 Mbytes of - presumably - garbage “produced”… while the Corona version shows 0.005-almost-nothing.

Which makes me think the garbage collector is set too aggressively - by either setting it or calling collectgarbage(). (and, no, you should not call collectgarbage() every frame)

BTW, how are you measuring that “used memory” under Corona ? [import]uid: 5750 topic_id: 4700 reply_id: 15035[/import]

@erpy:
the measurement is not 100% accurate but it does show you the changes in your texture memory usage so it is useful for detecting leaks.
Here is the module to do so, I am not the creator: http://developer.anscamobile.com/code/output-fps-and-texture-memory-usage-your-app

The 5mb is not garbage, it’s texture memory. [import]uid: 11334 topic_id: 4700 reply_id: 15060[/import]

Well, if that’s texture memory, that’s extremely weird then. I don’t know “Lime” either (can you post a link ?).
If that’s all due to the audio bug, well, it must be a heck of a nasty bug… otherwise it looks like a continuous free/load of big chunks of graphics the device cannot handle. (hence the “wrong” texture memory reading)

Consider that iPhone 3GS can handle a texture transfer rate of around 1 Mb/frame at 15/20 FPS… but if, in your case, sprite-sheets are being freed and loaded per frame, that could be a reason.
Corona simulator does not emulate the actual device hardware… while XCode simulator does.

Just guessing tho. [import]uid: 5750 topic_id: 4700 reply_id: 15065[/import]

erpy:
http://developer.anscamobile.com/forums/lime
[import]uid: 11334 topic_id: 4700 reply_id: 15116[/import]

I am bumping this so it won’t get lost in the pile [import]uid: 11334 topic_id: 4700 reply_id: 15376[/import]

not even a pity reply here? [import]uid: 11334 topic_id: 4700 reply_id: 16180[/import]

Few more days till the next drop… Hopefully it will be sorted then. [import]uid: 11393 topic_id: 4700 reply_id: 16203[/import]