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:
#import "NanoProfiler.h"
+(void) initialize {
AddProfiler([MyClass class], @selector(foo));
}
–(void) foo {
…
}
And you get a result like this:
*** 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.
- Open Source Library That Makes Objective-C And UIWebView Interaction More Convenient
- Objective-C Runtime Additions Allows Swizzling Without Creating A Category And More
- Open Source: Easy To Use High Performance iOS Audio (Recording And Playback) Library
- Interesting Open Source Framework For Developing Real Time Musical Instruments On iOS Devices
- How To Easily And Accurately Time Objective-C Blocks To See Which Code Performs Better
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.