My game is suddenly slower

Discussion in 'iOS Programming' started by mlady, Feb 11, 2009.

  1. mlady macrumors member

    Joined:
    Sep 18, 2008
    #1
    hi,
    I am doing a game, starting from a prototype, which seemed ok, so I have started to add things and tweaks.

    Now from an unknown reason to me it looks slower, the accelometer or buttons don't respond how they should, sometimes it freezes for a micromoment, basically it does things it never did.

    I am not looking for ultimate answer, cuz this might cause anything as the code has more than 1500 lines, but some kind of tips and trick what to look for or maybe somebody is experiencing the same problem.

    ie I know that NSLog() slower it down significantly so I watch out for this. I dont know, it might be some bad memory management as the game is getting bigger...

    Thanks for ANY help.
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    Are you using NSTimer? You could turn up the delay between loops (assuming your fps is fairly high at the moment).

    Profiling will show you where in your code you're spending most time, so optimise accordingly.

    Try running through with Clang and Valgrind (Leaks is useful to an extent, but tends to miss a lot of things).
     
  3. kalimba macrumors regular

    Joined:
    Jun 10, 2008
    #3
    Without knowing what type of game you're doing and what's involved with it, it's difficult to tell what could be going on.

    If it's "suddenly slower", you can probably examine the recent changes you've made to determine the cause of the slowdown. If what you really mean is that over a longer period of time your game has slowed from its original pace, that's to be expected to some degree.

    Do you have a group of game objects that has recently gotten larger? Do you have loops in your code that require comparing every object with every other object? Have you added any processor-intensive code, like -- say -- a physics simulator? These are just a couple of things that you could be looking for to locate performance problems.
     

Share This Page