ARPerformanceScout

A slim tool for discovering Objective-C performance bottlenecks.


License
MIT
Install
pod try ARPerformanceScout

Documentation

WARNING: This project is no longer maintained!

For performance testing, give XCode's Instruments a try - a very good tool IMHO.


ARPerfomanceScout

⊛ ARPerformanceScout ⊛ is a slim tool for discovering Objective-C performance bottlenecks.

  • Determine if a piece of code is blocking the UI.
  • Test performance when code execution jumps from one thread to another.
  • Experiment with multi-threaded programming.

Warning

This tool is in the very early stages of the development, so things will break and do random crazy stuff. Still trying to get the API right and then push it in a single direction. If you have any ideas, opinions or rants I'd love to hear them!

How to get started

Usage

﹆ Blocking a thread

When in doubt if a method is blocking the UI or not, calling ARpS_blockThread() makes it obvious very quickly.

 /* blocks the current thread for 3 seconds */
 ARpS_blockThread(3);
 

﹆ Measuring running time

To find out how many seconds a block of code takes to run, use ARpS_measure().

/* Measures the time taken to run a piece of code on the current thread */
ARpS_measure(^{
        [self writeSomethingToAFile_blocksTheUI];
    });
 
≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌
⊛ ARPerformanceScout ⊛

✔ Measured: 2.512919s
≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌

﹆ Timing events

When two pieces of code from very different parts of the app need to be timed, `ARpS_startTimer()` and `ARpS_stopTimerAndLog()` can help.

/* FirstSourceFile.m */

- (void)firstDummyMethod {
        ...
        ARpS_startTimer();
}

/* SecondSourceFile.m */

- (void)secondDummyMethod {
        ...
        ARpS_stopTimerAndLog();
}

/* Resulting log message */

≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌
⊛ ARPerformanceScout ⊛

✔ Timed: 15.291372s
≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌≌

 

Caveats

  • ARpS uses a block-based API so one should be careful about retain-cycles (the weakSelf code-snippet is a good friend to have.)
  • ARpS_measure() will only take into account work being done on the thread it's called
  • ARpS_startTimer() and ARpS_stopTimerAndLog() don't work well (YET) when called on separate threads
  • XCode's Time Profiler is a more precise tool for performance bottleneck discovery. ARPerformanceScout is intended to be used with very short iteration cycles and as a guide only

Contact

Claudiu-Vlad Ursache

Artsy

License

ARPerformanceScout is available under the MIT license. See the LICENSE file for more info.