How much memory is allocated when using the Module Pattern?
<p>I want to refactor Snippet 1 to Snippet 2.  I don't think performance is quite an issue here considering the size, but I wanted to understand what was going on as far as memory use goes regarding this refactor to the module pattern.</p>

<p>The module pattern ensures that I only pull in this data from the DOM once which is what I want and it also forms a mini-registry pattern in that the data is private.</p>

<p>Both snippets have been tested and basically work.</p>

<p><strong>Snippet 1</strong> // Replace SUniverisals w/ SU</p>

<pre><code>var SUniversals = function () {
    // Pull from Server
    this.universals.path = document.getElementById('universals').getAttribute('data-path');
    this.universals.load = document.getElementById('universals').getAttribute('data-load');
    // Set Manually
    this.universals.debug = false;
};
SUniversals.prototype.universals = {};
SUniversals.prototype.get = function( key ) {
    return this.universals[ key ];
};
SUniversals.prototype.set = function( key, value ) {
    this.universals[ key ] = value;
};
</code></pre>

<p><strong>Snippet 2</strong></p>

<pre><code>var SU = ( function () 
{
    // private SU.get('load');
    var universals = {};
        universals.path = document.getElementById('universals').getAttribute('data-path');
        universals.load = document.getElementById('universals').getAttribute('data-load');
        universals.debug = false;
    // pubulic
    var publik = {};
        publik.get = function( key )
        {
            return universals[ key ];
        };
        publik.set = function( key, value )
        {
            universals[ key ] = value;
        };
        return publik;
}());
</code></pre>
