title: JavaScript Object Literal notation vs plain functions and performance implications?
body: <p>Suppose I have functions like:</p>
  
  <pre><code>function foo() {
  
  }
  
  function bar() {
  
  }
  </code></pre>
  
  <p>I can write above as Object Literal notation:</p>
  
  <pre><code>var Baz = {
    foo: function() {
    },
   bar: function() {
   }
  };
  </code></pre>
  
  <p>As far as I understand in the later case, an instance of Baz will be created when the script loads regardless if any Baz function is ever called. In the former case, function object is only created when that function is called. Am I correct about these assumptions? </p>
  
  <p>If I am correct then the former would have higher performance (less memory) than the later in application where these functions are rarely called.
  But the advantage of the later is that it gives greater modularity and lower global namespace pollution.</p>
  
  <p>What is your take on this from your professional experience?
  Is there a speed difference?</p>