title: C++ Reference Length Performance
body: <p>My question is simple, what is the performance loss due to reference length. I cannot explain myself but here is the sample:</p>
  
  <p>between this</p>
  
  <pre><code>C* pC = m_a-&gt;m_b-&gt;m_c;
  </code></pre>
  
  <p>and this expression</p>
  
  <pre><code>C* pC = m_b-&gt;m_c;
  </code></pre>
  
  <p>I am asking this because I have a global class which has a Singleton pattern and holds everything. I am accessing all of its members from its members like this.</p>
  
  <pre><code>class Global
  {
      A* a;
      X* x;
  };
  
  class A { B* b; };
  class B { C* c; }; // etc
  
  class X { Y* y; };
  class Y { Z* z; };
  class Z
  {
      void foo() { Global::GetInstance()-&gt;a-&gt;b-&gt;c-&gt;foo(); }
  }
  </code></pre>
  
  <p>Is this a good design? Any advice for this? I am having some trouble with this topic too <a href="https://stackoverflow.com/questions/18838947/qt-architecture-advice-needed">Qt Architecture Advice Needed</a></p>