AngularJS: digest for 1.2.7 (v16)

Revision 16 of this benchmark created on


Description

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script> <script> angularBase = angular; angular = undefined;</script>

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script> <script> angularExp = angular; angular = undefined;</script> <script> Benchmark.prototype.setup = function() { function createScopeTree(angular) { var rootScope = angular.injector(['ng']).get('$rootScope');

  for(var i=0; i < 1000; i++) {
    var child = rootScope.$new();
    for(var j=0; j < 100; j++) {
      child.a = {b:{c:1}};
      child.$watch('a.b.c', function() {});
    }
  }
  return rootScope;
}


var baseScope = createScopeTree(angularBase);
var expScope = createScopeTree(angularExp);

};

Benchmark.prototype.teardown = function() { baseScope = null; expScope = null; }; </script>

Preparation HTML

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.0.5/angular.min.js"></script>
<script> angularBase = angular; angular = undefined;</script>

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.7/angular.min.js"></script>
<script> angularExp = angular; angular = undefined;</script>

Setup

function createScopeTree(angular) {
      var rootScope = angular.injector(['ng']).get('$rootScope');
    
      for(var i=0; i < 1000; i++) {
        var child = rootScope.$new();
        for(var j=0; j < 100; j++) {
          child.a = {b:{c:1}};
          child.$watch('a.b.c', function() {});
        }
      }
      return rootScope;
    }
    
    
    var baseScope = createScopeTree(angularBase);
    var expScope = createScopeTree(angularExp);

Teardown


    baseScope = null;
    expScope = null;
  

Test runner

Ready to run.

Testing in
TestOps/sec
Base
baseScope.$digest();
ready
Experiment
expScope.$digest();
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.