title: What is better for performance creating Function or instance of the constructor Function?
body: <p>Does calling a function take the same resources and time, as creating an instance of the constructor function in javascript node v8.5.0? </p>
  
  <p>I find that they give me the same result, as:</p>
  
  <pre><code>var repo = function () {
  
  var db = {};
  
  var get = function (id) {
      console.log('Getting task ' + id);
      return {
          name: 'new task from db'
      }
   }
  
  var save = function (task) {
      console.log('Saving ' + task.name + ' to the db');
   }
  
  console.log('newing up task repo');
  return {
      get: get,
      save: save
   }
  
  }
   module.exports = repo();
  </code></pre>
  
  <p>When I replace <code>module.exports = repo();</code> with <code>module.exports = new repo;</code> it gives me the same result, but I need to know which one is better performance wise.</p>