Help! Game Lagging Really Bad--No Idea Why

HELP!!!

My app is lagging really bad on certain devices.  I’ve put tons of work and now this is the last obstacle I need to solve before publishing.  It runs pretty well on iPad 2, but I have tested it on iPhone 4g, iPhone 3g, and Kindle Fire (original) and it lags really badly.  Its at the point where its unplayable on these devices.

There’s isn’t really a memory leak I’ve been able to find or anything like that, and this game is simple enough that it seems strange that these devices can’t run it.  Memory used is around 2 mb and texture memory used ranges between 20 and 30 mb.  Seems to me like this is a very small amount of memory required.  Even the 3g has 128 mb of RAM–shouldn’t that be way more than what is necessary???

There’s no point in posting my code–I have monitored memory usage pretty closely and I’m quite sure there’s not significant leaks.  The game lags as soon as it starts too so it doesn’t seem like that’s the case.  Also it runs perfectly fine on iPad 2 even after being on for a prolonged period of time.  I just don’t understand what the problem is.

Any help would be much appreciated!  I’ve spent countless hours trying to fix this but with no luck.  I’ve resized a lot of my assets to lower resolutions–something I hate to do but I was willing to do it if it got rid of the lag.  But nothing has helped.  I just don’t understand why these devices can’t run this app–the memory usage seems within their limits but maybe I’m missing something.  Do those memory readings seem high to you?  Any advice would be super helpful.  

Thanks in advanced for any help anyone can offer!!!

Without the code or any hint at the game mechanic/type, I would mention that memory usage is not the only thing that will slow down your code. Remember that any calculations/algorithms/routines/functions/manipulations/etc you are running can easily slow down the code.

I.e. if you are traversing a table of 2000 elements every frame, i.e. 30 or 60 times a second, you can quickly exhaust the processors capabilities…

remember the rules about everything having to run before the frame is updated, so this can quickly kill your performance since everything is being essentially rerun 30/60 times a second…

Thanks so much for your response!

So a problem like that wouldn’t show up in memory usage?  I had assumed any problem with performance likely meant a memory issue.  Does the memory usage I reported sound especially high, or rather too high for those devices?  For example with iPhone 3g I believe it has 128 mb of ram.  I know some of that gets eaten up by the operating system but I assume there should be enough left to handle 20-30 mb of texture memory and only 2 mb of other memory.  I know its an older device but I’d still like to support it–and I’d certainly like to support 4g, which is also having problems running things.

If its not a memory problem–if its a processing issue like you suggest–is there a way I can measure that somehow?

Thanks again! 

Take a look here

http://developer.coronalabs.com/content/performance-and-optimization

Even here there are a bunch of tiny tweaks to make that can have huge performance impacts. Your memory usage has nothing to do with you performance is my guess. Either you are calculating the human genome in between frames, or you have some huge performance hog in your code that you need to break apart into a different module or something…can’t say much without more info really. Just look at that page and see what that gets you thinking about. Skip the part about memory leaks :slight_smile:

Not to suggest a paid option as the only recourse, but this is basically what I use Corona Profiler to look at. Memory usage is important, but it’s also important to see what is taking the most CPU cycles to execute per frame. (Arguably it’s much more important as CPU horsepower is much harder to come by than extra MBs of space on today’s devices). With Profiler I just set it up to look over a few seconds and tell me what is the most performance intensive, and then do everything I can to optimize it (ie: techniques in that link sean84 posted)

That is the program I was trying to think of the name of :slight_smile: Good start!

Thanks so much!

This is very helpful!  I was unaware of Corona Profiler.  This is exactly what I needed!  To solve this issue for a mere $9.99 would be really incredible.  Thanks again–I’ll give it a try!

Without the code or any hint at the game mechanic/type, I would mention that memory usage is not the only thing that will slow down your code. Remember that any calculations/algorithms/routines/functions/manipulations/etc you are running can easily slow down the code.

I.e. if you are traversing a table of 2000 elements every frame, i.e. 30 or 60 times a second, you can quickly exhaust the processors capabilities…

remember the rules about everything having to run before the frame is updated, so this can quickly kill your performance since everything is being essentially rerun 30/60 times a second…

Thanks so much for your response!

So a problem like that wouldn’t show up in memory usage?  I had assumed any problem with performance likely meant a memory issue.  Does the memory usage I reported sound especially high, or rather too high for those devices?  For example with iPhone 3g I believe it has 128 mb of ram.  I know some of that gets eaten up by the operating system but I assume there should be enough left to handle 20-30 mb of texture memory and only 2 mb of other memory.  I know its an older device but I’d still like to support it–and I’d certainly like to support 4g, which is also having problems running things.

If its not a memory problem–if its a processing issue like you suggest–is there a way I can measure that somehow?

Thanks again! 

Take a look here

http://developer.coronalabs.com/content/performance-and-optimization

Even here there are a bunch of tiny tweaks to make that can have huge performance impacts. Your memory usage has nothing to do with you performance is my guess. Either you are calculating the human genome in between frames, or you have some huge performance hog in your code that you need to break apart into a different module or something…can’t say much without more info really. Just look at that page and see what that gets you thinking about. Skip the part about memory leaks :slight_smile:

Not to suggest a paid option as the only recourse, but this is basically what I use Corona Profiler to look at. Memory usage is important, but it’s also important to see what is taking the most CPU cycles to execute per frame. (Arguably it’s much more important as CPU horsepower is much harder to come by than extra MBs of space on today’s devices). With Profiler I just set it up to look over a few seconds and tell me what is the most performance intensive, and then do everything I can to optimize it (ie: techniques in that link sean84 posted)

That is the program I was trying to think of the name of :slight_smile: Good start!

Thanks so much!

This is very helpful!  I was unaware of Corona Profiler.  This is exactly what I needed!  To solve this issue for a mere $9.99 would be really incredible.  Thanks again–I’ll give it a try!

Hi,

    In our game(Crazy Rocket) after remove ads there is no game logging .See this link:https://play.google.com/store/apps/details?id=com.crazy.crazyrocket

Hi,

  In our game (Crazy Rocket) after remove ads there is no game lagging.See this link:https://play.google.com/store/apps/details?id=com.crazy.crazyrocket

Hi,

    In our game(Crazy Rocket) after remove ads there is no game logging .See this link:https://play.google.com/store/apps/details?id=com.crazy.crazyrocket

Hi,

  In our game (Crazy Rocket) after remove ads there is no game lagging.See this link:https://play.google.com/store/apps/details?id=com.crazy.crazyrocket