Like young children — developers seldom remember to pick up after themselves when finishing a project. And while you might think that it’s not a big deal, you’d be wrong. As a developer leaving calls to NSLog() in your ‘Release’ code can significantly affect the performance of your iOS app.
Suppose that you’re developing an iOS app with a UIScrollView or UITableView. And within the scrollview’s delegate you place an NSLog() statement in the ‘scrollViewDidScroll’ method. This means that for every frame you have additional and unnecessary function calls which in turn consume CPU cycles.
Of course, no one likes cleaning up after themselves. So a quick and easy way to disable the NSLog calls in the ‘Release’ code is to define a wrapper macro for logging. What I do is define the following in my project’s .pch file
#define DebugLog(…) NSLog(@“%s (%d) %@”, __PRETTY_FUNCTION__, __LINE__, [NSString stringWithFormat:__VA_ARGS__])
So here’s a thought:
Automakers often make a point of advertising and co-branding their vehicles with other electronics and software makers. For example, there’s the Microsoft Sync system for Ford, Bose Audio systems for GM, etc. But I wonder if the same will ever be true for software and specifically for open source libraries.
In the year 3000, will consumers be able to look at a hardware/software product and see the list of “ingredients”? Why wouldn’t they? This is a very programmer-centric point of view, but I think it would benefit everyone to promote what open source libraries are “inside the box”. Better code libraries would begin to develop their own brand and reputation among consumers and let them know that the product contains quality components.
Will people actually know the difference between whether my apps are using the AFNetworking library vs the now defunct ASIHTTPRequest library? Well…no, but can you honestly tell me that you can tell the difference between an Bose 8-way speaker and the stock car speakers that came with your vehicle?
Food for thought.