Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
perf($injector): remove invoke optimization that doesn't work
Browse files Browse the repository at this point in the history
Closes #5388
  • Loading branch information
bwiklund authored and IgorMinar committed Dec 13, 2013
1 parent 30a8b7d commit 05e4fd3
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 05e4fd3

Please sign in to comment.