Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mlady

macrumors member
Original poster
Sep 18, 2008
31
0
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.
 

jnic

macrumors 6502a
Oct 24, 2008
567
0
Cambridge
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.

Are you using NSTimer? You could turn up the delay between loops (assuming your fps is fairly high at the moment).

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.

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

I dont know, it might be some bad memory management as the game is getting bigger...

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

kalimba

macrumors regular
Jun 10, 2008
102
0
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.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.