In the final stage of development for my current project, I wanted to track down some performance issues in the app.
The Macro Way
First I have been looking for a really simple solution, something like my former colleague Markus once implemented, and which worked like this:
1 2 3 4 5 6
Unfortunately I could not find anything similar, just a “Quick-And-Dirty”-Profiler using Objective-C++ (hey, I took that adjective from the header-file!) and a macro that required you to wrap the code you want to profile into a block.
I did not want to use the latter one because by wrapping your code into a profiling block, you cannot simply strip out the profiling code for production.
So I came up with a really simple solution that fits into a few lines of code: