title: How would you benchmark the performance of a function?
body: <p>Here's perhaps a more advanced question. If you have two functions that return a value,</p>
  
  <pre><code>int F(int input1, int input2)
  {
      int output;
      // &lt;Some algorithm that assigns value to output&gt;
      return output;
  }
  
  int D(int input1, int input2)
  {
      int output;
      // &lt;Another algorithm that assigns value to output&gt;
      return output;
  }
  </code></pre>
  
  <p>With the condition that <strong>F(a,b) == D(a,b)</strong> (both return the same value for the same inputs).</p>
  
  <p>If you'd like to benchmark their performance, how would you do it?
  More precisely, how would you isolate the time it takes to perform <strong>F(a,b)</strong> or <strong>D(a,b)</strong> such that it does <strong>not</strong> reflect the time it takes for the <em>other</em> secondary operations in the benchmark setup?</p>