The fastest, dirtiest, perhaps not very accurate way.
NSDate *startDate = [NSDate date]; self.itemsArray = [Helper changeTheA:self.itemsArray]; NSLog(@"changeTheA time taken: %f", -[startDate timeIntervalSinceNow]);
A slightly more active, but probably more useful solution, if you are doing basic profiling, can be seen here , it uses the C function, which executes the block that you provide.
A note from the big side
Since Justin points to the actual act of creating an NSDate
and then registering it will lead to interference with your measurements, and therefore this technique is really good for getting park data, and even then you should probably run large amounts of iterations of your code in the synchronization block. If you need accurate measurements, skip Justin's answer
source share