title: Function inlining—what are examples where it hurt performance?
body: <p>It's conventional wisdom that function inlining doesn't always benefit, and can even hurt performance:</p>
  
  <ul>
  <li><a href="http://lxr.linux.no/linux+v2.6.38/Documentation/CodingStyle#L692" rel="noreferrer">The Linux kernel style guide</a> warns against excessive inlining</li>
  <li>Google also <a href="http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml#Inline_Functions" rel="noreferrer">recommends programmers be careful with inlining</a></li>
  <li>The <a href="http://www.parashift.com/c++-faq-lite/inline-functions.html#faq-9.3" rel="noreferrer">C++ FAQ lite</a> says more of the same</li>
  </ul>
  
  <p>I understand why inlining is supposed to help—it eliminates function call overhead by including the called function in its caller.</p>
  
  <p>I also understand why people claim it can hurt performance—inlining functions can in some cases increase code size, which can eventually increase cache misses or even trigger extra page faults. This all makes sense.</p>
  
  <p>I'm having trouble, though, finding specific examples where inlining actually hurts performance. Surely if it's enough of a problem to be worth warning about it, someone somewhere must have come across an example where inlining is a problem. So, I ask…</p>
  
  <p>What is a good, concrete example of code where performance is actually hurt by function inlining?</p>