title: Firebase high memory and cpu usage
body: <p>I have the following controller</p>
  
  <pre><code>    var myApp = angular.module("MyApp", ["firebase"]);
  
      function MyController($scope, $firebase) {
      var rootRef = new Firebase("vivid-fire-447.firebaseio.com/products");
          // Automatically syncs everywhere in realtime
          $scope.products = $firebase(rootRef);
          $scope.products.$on('loaded', function(){
              var index = $scope.products.$getIndex();
  
              $scope.total = function(){
                  var total = 0;
  
                  index.forEach(function(i){
                      total += $scope.products.$child(i).price;
                  });
                  return total;
              };
          });
  
        }
  </code></pre>
  
  <p>and the following html</p>
  
  <pre><code>&lt;div ng-app="MyApp"&gt;
  
      &lt;div ng-controller="MyController"&gt;
          &lt;ul&gt;
              &lt;li ng-repeat="product in products | orderByPriority"&gt;{{product.code}}&lt;/li&gt;
          &lt;/ul&gt;
          &lt;div&gt;Total = {{total()}}&lt;/div&gt;
      &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>The problem is that when I show the total price of products Chrome cpu gets pegged at 100% and memory usage starts climbing rapidly and eventually the tab hangs.</p>
  
  <p>I noted using AngularJS Batarang that total method gets called continuosly?</p>
  
  <p>How can I get the total price of all products in an efficient way?</p>
  
  <p><a href="http://jsfiddle.net/ceap80/7VVGP/" rel="nofollow">JsFiddle</a></p>