AngularJS: digest
JavaScript performance comparison
Preparation code
<script src="https://code.angularjs.org/1.0.2/angular.min.js"></script>
<script> angularBase = angular; angular = undefined;</script>
<script src="https://code.angularjs.org/1.2.26/angular.min.js"></script>
<script> angularLegacy = angular; angular = undefined;</script>
<script src="https://code.angularjs.org/1.3.14/angular.min.js"></script>
<script> angularLatest = angular; angular = undefined;</script>
<script>alightInitCallback = function(alight) { window.alight7 = alight }</script>
<script src="http://angularlight.org/bin/alight.last.min.js"></script>
<script>alightInitCallback = function(b) { window.alight84=b() }</script>
<script src="http://angularlight.org/bin/alight_0.8.4.min.js"></script>
<script>alightInitCallback = function(b) { window.alight821=b() }</script>
<script src="http://angularlight.org/bin/alight_0.8.21.min.js"></script>
<script>
Benchmark.prototype.setup = function() {
function createScopeTree(angular, flag, useObserver) {
var rootScope;
if(flag) rootScope = angular.Scope({useObserver: useObserver});
else 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'+j] = {b:{c:1}};
child.$watch('a'+j+'.b.c', function() {});
}
}
if(useObserver) rootScope.$scan();
return rootScope;
}
var baseScope = createScopeTree(angularBase);
var legacyScope = createScopeTree(angularLegacy);
var latestScope = createScopeTree(angularLatest);
var ascope7 = createScopeTree(alight7, 1);
var ascope821 = createScopeTree(alight821, 1);
var ascope84o = createScopeTree(alight84, 1, true);
var ascope821o = createScopeTree(alight821, 1, true);
};
Benchmark.prototype.teardown = function() {
baseScope = null;
legacyScope = null;
latestScope = null;
ascope7 = null;
ascope821 = null;
ascope84o = null;
ascope821o = null;
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
Test | Ops/sec | |
---|---|---|
Angular 1.0.2
|
|
pending… |
Angular 1.2.26
|
|
pending… |
Angular 1.3.14
|
|
pending… |
Angular Light 0.7
|
|
pending… |
Angular Light 0.8
|
|
pending… |
Object.observe + Angular Light 0.8.4
|
|
pending… |
Object.observe + Angular Light 0.8.21
|
|
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.
- Revision 2: published AngularJS: digest
- Revision 4: published Misko Hevery
- Revision 5: published Misko Hevery
- Revision 6: published Misko Hevery
- Revision 10: published Map Vs For
- Revision 11: published
- Revision 12: published
- Revision 13: published
- Revision 15: published
- Revision 16: published
- Revision 17: published Marcin Operacz
- Revision 18: published
- Revision 19: published
- Revision 20: published
- Revision 21: published
- Revision 22: published
- Revision 23: published
- Revision 26: published
- Revision 28: published
- Revision 33: published XavierBoubert
- Revision 34: published
- Revision 35: published
- Revision 36: published
- Revision 37: published
- Revision 40: published kitallis
- Revision 41: published hayato
- Revision 42: published
- Revision 43: published Jay
- Revision 44: published
- Revision 45: published
- Revision 46: published
- Revision 49: published
- Revision 50: published santiago
- Revision 51: published
- Revision 53: published
- Revision 54: published
- Revision 55: published
- Revision 56: published
- Revision 58: published
- Revision 59: published
- Revision 60: published
- Revision 61: published
- Revision 62: published
- Revision 63: published
- Revision 64: published
- Revision 65: published Oleg
- Revision 66: published Oleg
- Revision 67: published Oleg
- Revision 68: published
- Revision 69: published Oleg
- Revision 70: published
- Revision 72: published
- Revision 73: published
- Revision 74: published Richard Collette
- Revision 75: published Rodrigo Branas
- Revision 76: published
- Revision 77: published
0 Comments