AngularJS: digest for different angular versions

JavaScript performance comparison

Revision 28 of this test case created

Info

Comparing digest of various angular versions.

Preparation code

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

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

<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js"></script>
<script> angular1211 = 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 scope108 = createScopeTree(angular108);
    var scope115 = createScopeTree(angular115);
    var scope1211 = createScopeTree(angular1211);
};

Benchmark.prototype.teardown = function() {
    scope108 = null;
    scope115 = null;
    scope1211 = 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
1.0.8
scope108.$digest();
pending…
1.1.5
scope115.$digest();
pending…
1.2.11
scope1211.$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