title: C++ virtual function execution efficiency
body: <p>I am trying to get a better idea of performance of virtual functions
  here is an example code:</p>
  
  <pre>
  struct Foo {
      virtual void function1();
      virtual void function2() { function1(); }
  };
  
  struct Bar : Foo {
      virtual void function1();
  }
  
  Bar b;
  Foo &f = b;
  
  b.function2();
  b.function1();
  f.function2();
  
  </pre>
  
  <p>for each of three calls in the last three lines of the code sample, do all of them have to look up function pointer in virtual table?  how many lookup have to be done for f object.  which once can be inlined by compiler?</p>
  
  <p>thanks</p>