JavaScript Object Literal notation vs plain functions and performance implications?
<p>Suppose I have functions like:</p>

<pre><code>function foo() {

}

function bar() {

}

I can write above as Object Literal notation:

var Baz = {
  foo: function() {
  },
 bar: function() {
 }
};
</code></pre>

<p>As for 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>
