title: Nodejs require: once or on demand?
body: <p>What is currently the best practice for loading models (and goes for all required files I guess)?</p>
  
  <p>I'm thinking these two ways to achieve the solution (nonsense code to illustrate follows):</p>
  
  <pre><code>var Post = require('../models/post');
  
  function findById(id) {
      return new Post(id);
  }
  
  function party() {
      return Post.getParty();
  }
  </code></pre>
  
  <p>vs</p>
  
  <pre><code>function findById(id) {
      return new require('../models/post')(id);
  }
  
  function party() {
      return require('../models/post').getParty();
  }
  </code></pre>
  
  <p>Is one of these snippets preferred? Are there considerable memory and time tradeoffs? Or is it just a premature optimization?</p>