AngularJS: digest

JavaScript performance comparison

Revision 21 of this test case created

Preparation code

<script src="//code.angularjs.org/1.2.7/angular.min.js"></script>
<script> angularBase = angular; angular = undefined;</script>

 
<script>
Benchmark.prototype.setup = function() {
    function createScopeTree(angular) {
      var rootScope = angular.injector(['ng']).get('$rootScope');
   
      for(var i=0; i < 100; 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);
   
};

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

Preparation code output

Test runner

Warning! For accurate results, please disable Firebug before running the tests. (Why?)

Java applet disabled.

Testing in unknown unknown
Test Ops/sec
Base
baseScope.$digest();
pending…
Experiment
expScope.$digest();
pending…

Compare results of other browsers

Revisions

You can edit these tests or add even more tests to this page by appending /edit to the URL. Here’s a list of current revisions for this page:

0 comments

Add a comment