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

Commit cbdf0c2

Browse files
committed
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
1 parent 1111076 commit cbdf0c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/ng/parse.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1020,7 +1020,7 @@ function getterFn(path, options, fullExp) {
10201020
// we simply dereference 's' on any .dot notation
10211021
? 's'
10221022
// but if we are first then we check locals first, and if so read it first
1023-
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
1023+
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '.' + key + ';\n' +
10241024
(options.unwrapPromises
10251025
? 'if (s && s.then) {\n' +
10261026
' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +

0 commit comments

Comments
 (0)