Easy To Use Objective-C Library For Profiling The Performance Of A Specific Method

Sometimes when optimizing performance you may want to go beyond Xcode’s instruments and early last year I mentioned an example showing how to accurately time Objective-C blocks.

Here’s a new library called NanoProfiler that makes it very easy to time the performance of a specific method.  With this library you don’t have to perform any modifications to the method, you simply set up the profiler to run a specific method, and get the result.

Here’s an example from the readme showing how to use NanoProfiler:

//MyClass.m
#import "NanoProfiler.h"

+(void) initialize {
AddProfiler([MyClass class], @selector(foo));
}

(void) foo {

}

And you get a result like this:

*** Timer MyClass_foo started. ***
*** Timer MyClass_foo stopped. runtime: 1.633041 milliseconds ***

You can find NanoProfiler on Github here.

An easy way to compare the efficiency of different pieces of code.

DeliciousTwitterFacebookRedditLinkedInEmail

Original article: Easy To Use Objective-C Library For Profiling The Performance Of A Specific Method

©2013 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *