Angularjs expression size and watches
In Angular you can explicitly register a watch and a callback to be called when it changes e.g. $scope.$watch(expression, callback) ..or implicitly using a binding expression e.g. {{userName}} Angular keeps track of all watches on scope so that it can detect when changes have occurred and thus update the DOM or call a watch callback. Angulars code to detect changes by evaluating all the watches is called the "digest loop". The digest loop stores the value of the watch expression evaluation and when next the cycle runs it compares the old value to newly computed expression value. If there are differences then it will eventually intelligently update the dom and/or call impacted watch callbacks (once all changes have been resolved) The awesome book "Mastering Web Application Development with AngularJS" explains this well in Chapter 11. Chapter 11 includes a section on performance tuning. One advice is to "Consider the size of expre...