From 864b2596b246470cca9d4e223eaed720f4462319 Mon Sep 17 00:00:00 2001 From: Karl Seamon Date: Thu, 5 Dec 2013 18:08:52 -0500 Subject: perf($parse) use a faster path when the number of path parts is low Use a faster path when the number of path tokens is low (ie the common case). This results in a better than 19x improvement in the time spent in $parse and produces output that is about the same speed in chrome and substantially faster in firefox. http://jsperf.com/angularjs-parse-getter/6 Closes #5359 --- test/ng/parseSpec.js | 1 + 1 file changed, 1 insertion(+) (limited to 'test') diff --git a/test/ng/parseSpec.js b/test/ng/parseSpec.js index 2147c4b0..5e985f1f 100644 --- a/test/ng/parseSpec.js +++ b/test/ng/parseSpec.js @@ -906,6 +906,7 @@ describe('parser', function() { expect($parse('a.b')({a: {b: 0}}, {a: {b:1}})).toEqual(1); expect($parse('a.b')({a: null}, {a: {b:1}})).toEqual(1); expect($parse('a.b')({a: {b: 0}}, {a: null})).toEqual(undefined); + expect($parse('a.b.c')({a: null}, {a: {b: {c: 1}}})).toEqual(1); })); }); -- cgit v1.2.3