基本的に、クロージャーを使用しない場合、ミックスインが使用されるたびにミックスイン関数が作成されます。クロージャを作成することにより、各関数が1回作成され、ミックスインは呼び出されるたびにそれらの関数を参照します。ミックスインは実行するたびにこれらの関数を再作成する必要がないため、より高速になります。
閉鎖なし
var asRectangle = function() {
  // every time this function is called, these three functions are created
  // from scratch, slowing down execution time
  this.area = function() {
    return this.length * this.width;
  }
  this.grow = function() {
    this.length++, this.width++;
  }
  this.shrink = function() {
    this.length--, this.width--;
  }
})();
閉鎖で
var asRectangle = (function() {
  // these functions are 'cached' in the closure
  function area() {
    return this.length * this.width;
  }
  function grow() {
    this.length++, this.width++;
  }
  function shrink() {
    this.length--, this.width--;
  }
  // this function is set to asRectangle.  it references the above functions
  // every time it is called without having to create new ones
  return function() {
    this.area = area;
    this.grow = grow;
    this.shrink = shrink;
    return this;
  };
})();