title: Does extracting functions affect performance?
body: <p>I'm considering dissecting long functions to several smaller ones and I'm concerned about performance. Say we have a long function with many lines of code:</p>
  
  <pre><code>void f(){
  ....
  }
  </code></pre>
  
  <p>Now if we extract pieces of work to separate functions:</p>
  
  <pre><code>void f(){
    f1();
    f2();
    f3();
  } 
  </code></pre>
  
  <p>Does it usually affect performance? I'm in search of a <strong>general</strong> <strong>strategy</strong> to balance performance and good software design. Is it always a good practice to have small functions? assume a class with a private member variable <code>int something</code>. Is it free to return it by calling <code>get_something()</code> instead of making <code>something</code> public?</p>
  
  <p>Assume functions as non-virtual and optimization level on <code>/O3</code>. The importance of the question is that if the first version is faster we will face a trade-off between maintainability and performance. </p>