As a new programmer, I discovered the magic of NSlog and use it all through my code. This was very useful (along with NSZombieEnabled ) when debugging.
I can see a certain performance hit on the simulator as it prints it all. I do not think that I see such a hit on devices, but I'm not sure.
So is it worth something to leave all NSLogs ? Does he use more memory on the device? Or does the compiler simply ignore them, like compilation comments for a device?
EDIT:
Here, what I have implemented is on a proposal from rano.
In my App_Prefix.pch file, I added:
// DLog is almost a drop-in replacement for NSLog // DLog(); // DLog(@"here"); // DLog(@"value: %d", x); // Unfortunately this doesn't work DLog(aStringVariable); you have to do this instead DLog(@"%@", aStringVariable);
And then in my Project Info inspector for the Debug configuration under the GCC 4.2 - Preprocessing, heading GCC 4.2 - Preprocessing, I added the Debug value to the top entry called Preprocessor Macros.
Works like a spell - DLog displays when I build a version of Debug and ALog always issues.
ios memory iphone nslog
Steve
source share