From c54228fbe9d42d8a3a159bf84dd1d2e99b259ece Mon Sep 17 00:00:00 2001 From: Igor Minar Date: Thu, 24 Jul 2014 07:40:05 -0700 Subject: [PATCH] perf($parse): don't use reflective calls in generated functions Chrome and FF are smart enough to notice that the key is is a string literal, so this change doesn't make a difference there. Safari gets a boost. I haven't tested IE, but it can't cause harm there. :) http://jsperf.com/fn-dereferencing --- src/ng/parse.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ng/parse.js b/src/ng/parse.js index dbebc5b4..78582bde 100644 --- a/src/ng/parse.js +++ b/src/ng/parse.js @@ -909,7 +909,7 @@ function getterFn(path, options, fullExp) { // we simply dereference 's' on any .dot notation ? 's' // but if we are first then we check locals first, and if so read it first - : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n'; + : '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '.' + key + ';\n'; }); code += 'return s;';