title: How do I profile how long a piece of code takes to execute in Objective-C/Cocoa for optimization purposes
body: <p>Lets say I've got two interchangeable pieces of code and I want to figure out which one of them takes less processor time to execute. How would I do this?</p>
  
  <p>To get a very rough estimation I could just put NSLog() calls on either side of the code I wanted to profile, but it seems like the processor being otherwise very busy could skew the results.</p>