cctmmpeining / closure-library

Automatically exported from code.google.com/p/closure-library
0 stars 0 forks source link

Patch for /closure/goog/base.js #629

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I inserted the following code into the goog.inherits() > childCtor.base() 
function as a possible performance improvement.

  // Slicing the arguments and using apply() can both be avoided if
  // the number of arguments is less than 3.
  if (arguments.length < 3) {
    return parentCtor.prototype[methodName].call(me);
  }

The original code follows the new code.

Original issue reported on code.google.com by RetroModular on 14 Mar 2014 at 8:06

Attachments:

GoogleCodeExporter commented 8 years ago
given that the whole point of this method is to be optimized away at 
compile-time, I don't think we should be adding complexity to optimize it.

Original comment by Nicholas.J.Santos on 2 Apr 2014 at 8:00

GoogleCodeExporter commented 8 years ago
Maybe adding the comment "this method is to be optimized away at compile-time" 
to the source code would inform those of us who are outside of the project that 
the method is to be optimized away at compile-time.

Just a thought :)

Original comment by RetroModular on 2 Apr 2014 at 9:59