Get Updates By E-mail 

Article Written By:
Johann Dowa

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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments