title: Is JavaScript function call faster through prototype or direct reference?
body: <p>In JavaScript, let's say I want to call aObj.myMethod() from inside bObj. In the case of my application, from the design point of view, aObj is the base class for bObj. JavaScript is a late binding language, which means that myMethod should be resolved at run time. Is the function resolution faster </p>
  
  <p>////////// IF</p>
  
  <p>1-I go naturally with my design and say bObj.prototype=aObj and then at run time I call bObj.myMethod: </p>
  
  <pre><code>function bObj(){...};
  
  bObj.prototype=aObj;
  
  
  //later
  var myBObj=new bObj();
  myBObj.myMethod();
  </code></pre>
  
  <p>////////////////////////OR</p>
  
  <p>2- function resolution can be slow through the prototypes so I keep aObj as a property in bObj, and from inside bObj I call aObj.myMethod()</p>
  
  <pre><code>function bObj()
  {
    this.myAObj=new aObj();
    ...
  }     
  
  //later:
  var myBObj=new bObj();
  myBObj.myAObj.myMethod();
  </code></pre>
  
  <hr>
  
  <p>My main concern is the execution speed. In my application myMethod is being called millions of times per second. I know that most of the browsers cache the pointers to recently called functions so in both cases the function resolution process gets speeded up. Yet can anyone provide more details on the function resolution mechanism in these two cases and give some insight that which method can be possibly faster? Is the resolution mechanism the same in all the browsers or it is completely browser-dependent? </p>