Skip to content

Commit

Permalink
perf($injector): remove invoke optimization that doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
bwiklund authored and jamesdaily committed Jan 27, 2014
1 parent 79f3786 commit a00e26c
Showing 1 changed file with 3 additions and 18 deletions.
21 changes: 3 additions & 18 deletions src/auto/injector.js
Original file line number Diff line number Diff line change
Expand Up @@ -769,24 +769,9 @@ function createInjector(modulesToLoad) {
fn = fn[length];
}


// Performance optimization: http://jsperf.com/apply-vs-call-vs-invoke
switch (self ? -1 : args.length) {
case 0: return fn();
case 1: return fn(args[0]);
case 2: return fn(args[0], args[1]);
case 3: return fn(args[0], args[1], args[2]);
case 4: return fn(args[0], args[1], args[2], args[3]);
case 5: return fn(args[0], args[1], args[2], args[3], args[4]);
case 6: return fn(args[0], args[1], args[2], args[3], args[4], args[5]);
case 7: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6]);
case 8: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7]);
case 9: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
args[8]);
case 10: return fn(args[0], args[1], args[2], args[3], args[4], args[5], args[6], args[7],
args[8], args[9]);
default: return fn.apply(self, args);
}
// http://jsperf.com/angularjs-invoke-apply-vs-switch
// #5388
return fn.apply(self, args);
}

function instantiate(Type, locals) {
Expand Down

0 comments on commit a00e26c

Please sign in to comment.