I have a lot of NSLog
's in my app - some of which often print large amounts of data - ie results of a search. Will this make an appreciable difference in the speed of my app?
I'm not familiar with macros - would someone be able to suggest one that would enable/disable all NSLogs?
Yes NSLog
could make your app slower because of its synchronism.
To toggle all NSLog
#ifdef DEBUG
#define NSLog(...) NSLog(__VA_ARGS__)
#else
#define NSLog(...)
#endif
You should use something like DLog
from MY CURRENT PREFIX.PCH FILE. It'll disable logging in the Release build. This is a great explanation of why you shouldn't keep NSLog
's in the Release build.
If your app is for production try to minimize them. Keep only the ones useful for errors or possible warnings. If you used them for helping you debug, then I advise you to remove them.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With