title: Namespacing technique in JavaScript, recommended? performant? issues to be aware of?
body: <p>In a <a href="http://www.sourceforge.net/projects/webglu/" rel="nofollow noreferrer" title="WebGLU">project</a> I am working on I am structuring my code as follows</p>
  
  <pre><code>MyLib = {
      AField:0,
  
      ASubNamespace:{
          AnotherField:"value",
  
          AClass:function(param) {
              this.classField = param;
  
              this.classFunction = function(){
                  // stuff
              }
          }
      },
  
      AnotherClass:function(param) {
          this.classField = param;
  
          this.classFunction = function(){
              // stuff
          }
      }
  }
  </code></pre>
  
  <p>and so on like that to do stuff like:</p>
  
  <pre><code>var anInstance = new MyLib.ASubNamespace.AClass("A parameter.");
  </code></pre>
  
  <p>Is this the right way to go about achieving namespacing? Are there performance hits, and if so, how drastic? Do performance degradations stack as I nest deeper? Are there any other issues I should be aware of when using this structure?</p>
  
  <p>I care about every little bit of performance because it's a library for realtime graphics, so I'm taking any overhead very seriously.</p>