Commit Graph

5478 Commits

Author SHA1 Message Date
Igor Minar
e3f26b5a6b style(jqLite): use the common for loop code style 2014-08-16 22:29:00 -07:00
Igor Minar
c1cb341c87 refactor($compile): simplify controllersBoundTransclude check
no measurable perf difference, but the code more simple and minifies better
2014-08-16 22:10:04 -07:00
Igor Minar
0605e612e1 chore(angular.suffix): fix typo 2014-08-16 22:09:56 -07:00
Igor Minar
645625cf34 perf($compile): refactor publicLinkFn to simplify the code and use 'for in' loop 2014-08-16 22:09:48 -07:00
Igor Minar
e822e9061c perf(Scope): optimize $watchCollection when used for watching objects
Since we control the oldValue, we don't need to worry about proto-inhereted properties which means we can use
'for in' and skip hasOwnProperty checks.

http://jsperf.com/for-in-vs-object-keys2
2014-08-16 22:09:38 -07:00
Igor Minar
301463a2e2 perf(Scope): don't use forEach in
doesn't make any significant impact on our current benchmarks because we don't have benchmarks with
many scope events, but this is a straightforward change worth doing
2014-08-16 22:09:29 -07:00
Igor Minar
7d96ab0d13 perf(Scope): watchCollection optimization
tiny ~4ms improvement and code that minifies better
2014-08-16 22:09:21 -07:00
Igor Minar
0a738ce176 perf(ngBind): bypass jquery/jqlite when setting text 2014-08-16 22:08:59 -07:00
Igor Minar
d208ba2544 perf(isObject): use strict comparison
this is a micro-optimization based on http://jsperf.com/isobject4

no significant improvement in macro-benchmarks, but since it makes the code better it makes
sense making this change.
2014-08-16 22:06:14 -07:00
Igor Minar
de3f238764 chore(test): rename getBlockElements to getBlockNodes in .jshintrc for tests 2014-08-16 22:00:10 -07:00
Igor Minar
d302ea0cfa perf($parse): use no-proto maps as caches and avoid hasOwnProperty checks 2014-08-16 21:59:38 -07:00
Igor Minar
a09fa35641 perf(Scope): exit $broadcast early if nobody is listening for the given event 2014-08-16 21:52:10 -07:00
Igor Minar
36e35b2cb1 perf(ngRepeat): optimize marking of nodes that are being removed via an animation 2014-08-16 21:52:04 -07:00
Igor Minar
13d113c522 perf(ngRepeat): use no-proto objects for blockMaps 2014-08-16 21:51:56 -07:00
Igor Minar
215d9545dc style(ngRepeat): ws and indentation fixes 2014-08-16 21:51:49 -07:00
Igor Minar
bdd853cb83 perf(ngRepeat): move work to compile fn
this has impact only on nested repeaters where the number of columns is significant
2014-08-16 21:51:40 -07:00
Igor Minar
e58d65a520 perf(ngRepeat): move updateScope fn to factory and reuse it for all repeaters 2014-08-16 21:51:33 -07:00
Igor Minar
fbd48845e0 perf(ngRepeat): clone boundary comment nodes
http://jsperf.com/clone-vs-createcomment

most of the improvement comes from not reconcatinating the strings
2014-08-16 21:51:27 -07:00
Igor Minar
abb17cce8b perf(jqLite): optimize off()
'for in' is much faster than Object.keys() and since the events object is ours, we know
that we don't need to worry about prototypically inherited properties so we can skip
expensive hasOwnProperty check.

http://jsperf.com/for-in-vs-object-keys2
2014-08-16 21:51:17 -07:00
Igor Minar
3e0a2e1f33 perf($compile): clone the nodeList during linking only if necessary 2014-08-16 21:51:06 -07:00
Igor Minar
1e8698b33e perf(jqLite): refactor jqLiteExpandoStore to minimize access to expensive element.ng339 expando property 2014-08-16 21:50:27 -07:00
Igor Minar
503dcb0281 style(jqLite): rename onFn to jqLiteOn 2014-08-16 21:31:41 -07:00
Igor Minar
bf2e238418 refactor(jqLite): clean up jqLiteRemoveData fn 2014-08-16 21:31:35 -07:00
Igor Minar
8b77161702 refactor(Scope): remove useless compileToFn helper fn 2014-08-16 21:31:20 -07:00
Igor Minar
50e16a67bb refactor(Scope): rename $$childScopeClass to ChildClass to simplify debugging/profiling 2014-08-16 21:31:17 -07:00
Igor Minar
b9b1aa7797 refactor($parse): simplify addInterceptor fn 2014-08-16 21:30:49 -07:00
Igor Minar
a1341223c0 perf($parse): trim expression only if string 2014-08-16 21:30:44 -07:00
Igor Minar
99d70af11c style($parse): rename variables in generated code so that code is more readable 2014-08-16 21:30:38 -07:00
Igor Minar
6acea1152f fix($parse): remove unused variable declaration in generated getters 2014-08-16 21:30:32 -07:00
Igor Minar
33ab57948c style(ngRepeat): fix indentation 2014-08-16 21:30:27 -07:00
Igor Minar
31ed0af74b perf($compile): delay object initialization in nodeLinkFn 2014-08-16 21:30:20 -07:00
Igor Minar
13112710e6 refactor: remove unused variables 2014-08-16 21:30:07 -07:00
Igor Minar
54fa16e45d perf: speed up shallowCopy and special case Attributes cloning
`for in` is much faster than `Object.keys()` but `for in` includes properties from the prototype.

http://jsperf.com/for-in-vs-object-keys2

All the uses of shallowCopy don't deal with objects with heavy prototypes, except for Attributes instances
in $compile.

For this reason it's better to special-case Attributes constructor and make it do it's own shallow copy.
This cleans up the Attribute/$compile code as well.
2014-08-16 21:29:51 -07:00
Igor Minar
fb00210cb6 refactor(shallowCopy): microoptimization 2014-08-16 21:01:13 -07:00
Igor Minar
fafbd49490 perf(jqLite): microoptimization in chaining fn
note: no siginificant difference observed in macrobenchmarks, so this is just to make
me feel better :)
2014-08-16 21:01:13 -07:00
Igor Minar
bda673f8e7 perf(jqLite): don't use String#split in on() unless we need it 2014-08-16 21:01:13 -07:00
Igor Minar
b678f314f1 refactor(jqLite): don't look up the entry needlessly 2014-08-16 21:01:13 -07:00
Igor Minar
550965f111 style(jqLite): remove MiskoCode(tm) 2014-08-16 21:01:13 -07:00
Igor Minar
443b521e22 perf(jqLite): don't check isString many times in constructor
Note: no significant perf gain in Chrome
2014-08-16 21:01:12 -07:00
Igor Minar
e6a9f9e130 refactor: simplify trim fn now that IE9 has String#trim 2014-08-16 21:01:12 -07:00
Igor Minar
441ab5235c refactor: rename getBlockElements to more correct getBlockNodes 2014-08-16 21:01:11 -07:00
Igor Minar
6b7b40af74 style(ngBind): name anonymous link fn to ease debugging/profiling 2014-08-16 15:38:50 -07:00
Igor Minar
edc586f911 refactor(ngBindHtml): improve readability of the code 2014-08-16 15:36:32 -07:00
Igor Minar
c7393093ff refactor(ngRepeat): name anonymous transclude callback for better debugging 2014-08-16 15:32:43 -07:00
Igor Minar
b493c62f6b perf(jqLite): optimize jqLiteAcceptsData method
This doesn't show up too high in profiles, but this code is cleaner anyway
2014-08-16 15:32:32 -07:00
Igor Minar
35134a0e23 perf($compile): optimize nodeLinkFn
Functions with try/catch block can't be optimized, so we can
move the try/catch block into a tiny fn and make it possible for the
complex nodeLinkFn to get optimized.
2014-08-16 15:32:24 -07:00
Igor Minar
8d933bf995 perf(jqLite): optimize append() and after() 2014-08-16 15:31:10 -07:00
Igor Minar
6251751ad7 perf(jqLite): don't register DOM listener for $destroy event
This even is fired purely within jqLite/jQuery so it doesn't make sense to register DOM listener here.

6% improvement in large table benchmark for both creation and destruction
2014-08-16 15:05:22 -07:00
Igor Minar
8f10dca300 refactor(jqLite): remove legacy code to support IE8 and older 2014-08-16 15:05:22 -07:00
Igor Minar
566f1015d2 perf(jqLite): optimize event listener registration 2014-08-16 14:31:29 -07:00