Being able to accurately time code to see which performs faster is extremely useful. That being said it can be extremely difficult to find a timing function that is accurate enough to time in small increments.
Tools such as the Profiler can show you lagging areas within your code, but aren’t really designed to track the performance of one piece of code vs. another.
Mark Dalrymple has put together a nice snippet of code along with an example on how to use showing you to how to easily and accurately compare the performance of one Objective-C block vs. another.
You can find the example on the Big Nerd Ranch website here.
Extremely useful for squeezing out that last bit of performance, no question as to whether or not one piece of code really runs faster than another – you can find out for certain.
©2012 iPhone, iOS 5, iPad SDK Development Tutorial and Programming Tips. All Rights Reserved.
.






