Don’t abuse NSLog in your iPhone game
April 8th, 2010I’m working on a simple game for iPhone based on cocos2d. Yesterday I installed it on my old iPhone3G and it was veeeeeeeery slow. After a lot of refactoring I found a NSLog call inside my game loop. It basically logged all the collision detection of the player with all the tiles in the map. After removing that it’s even faster then before. So, if you want to log something, do it, but remember to remove all these logging calls later.














4:50 pm on April 8th, 2010:
or, at least, wrap NSLog () calls in #ifndef NDEBUG/#endif directives
http://www.google.co.uk/codesearch?q=nslog+ndebug
7:01 pm on April 14th, 2010:
CCLOG is your friend. Use CCLOG instead of NSLog and it’s taken care of for you.
9:27 pm on April 14th, 2010:
awesome, thank you guys for your advices!!