title: What are the actual runtime performance costs of dynamic dispatch?
body: <p>There's some background on this topic in the Rust book section on <a href="https://doc.rust-lang.org/1.0.0-beta/book/static-and-dynamic-dispatch.html" rel="noreferrer">static and dynamic dispatch</a>, but the tl;dr is that calling a method on a trait reference and a few other various situation (function pointers, etc) results in dynamic instead of static dispatch.</p>
  
  <p>What is actual runtime cost of this, after optimizations have been applied?</p>
  
  <p>For example, imagine this set of structs &amp; traits:</p>
  
  <pre><code>struct Buffer;
  struct TmpBuffer;
  struct TmpMutBuffer;
  
  impl BufferType for Buffer { ... }
  impl BufferType for BufferTmp { ... }
  impl BufferType for BufferTmpMut { ... }
  
  impl Buffer2D for BufferType { ... }
  
  impl Buffer2DExt for Buffer2D { ... }
  </code></pre>
  
  <p>Notice that the traits here are implemented on traits themselves.</p>
  
  <p>What is the calling cost of dynamic dispatch to invoke a method from <code>Buffer2DExt</code> on a struct reference?</p>
  
  <p>The recent question <a href="https://stackoverflow.com/questions/28519997/what-are-rusts-exact-auto-dereferencing-rules">What are Rust&#39;s exact auto-dereferencing rules?</a> regards the dereferencing rules; are these rules applied at compile time, or runtime?</p>