Angular VS Ember VS Backbone (v28)

Revision 28 of this benchmark created on


Preparation HTML

<script src="https://code.jquery.com/jquery-1.9.1.min.js">
</script>

<!-------- Angular -------->
<div ng-app="ANGAPP" id="angapp" ng-controller="Ctrl">
        <h3>Angular</h3>
        <span ng-repeat="item in items">{{item}}</span>
</div>

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.3/angular.min.js">
</script>

<script>
angular.module('ANGAPP', [])
        .controller('Ctrl', function($scope) {
        $scope.items = [];
    $scope.clear = function(){$scope.items = [];};
    $scope.push = function(item){ $scope.items.push(item);};
        window.ANG = {
      $scope : $scope
        };
        });
</script>
<!-------- End Angular -------->


<!-------- Backbone-------->
<div id="backboneapp">
  <h3>Backbone</h3>
  <span class="backbone-items"></span>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.7.0/underscore-min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.1.2/backbone-min.js"></script>
<script>
// Backbone.js
var backboneView = Backbone.View.extend({
  push: function(i) {
    this.$el.append(i);
  },
  clear: function() {
    this.$el.html('');
  }
});

window.BB = new backboneView({el: "#backboneapp .backbone-items"});
</script>
<!-------- End Backbone -------->

<!-------- Ember-------->
<div id="emapp">
  <h3>Ember:</h3>
  <script type="text/x-handlebars">
    <span>
      {{#each EMapp.data}}<span>{{this}}</span>{{/each}}
    </span>
  </script>
</div>

<script src="https://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.3.0/handlebars.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.8.1/ember.js"></script>

<script>
  EMapp = Ember.Application.create({
    rootElement: $('#emapp')
  });
  EMapp.data = Ember.A();
  
  EMclear = function () {
    EMapp.get('data').clear();
  };
  EMreset = function () {
    EMapp.set('data', Ember.A());
  };
  EMpush = function (data) {
    EMapp.get('data').pushObject(data);
  };
</script>
<!-------- End Ember -------->

Test runner

Ready to run.

Testing in
TestOps/sec
Angular
ANG.$scope.clear();
for (var i = 0; i < 500; i++) {
  ANG.$scope.push(i);

}
ANG.$scope.$apply();
ready
Backbone
BB.clear();
for (var i = 0; i < 500; i++) {
  BB.push(i);
}
ready
Ember
EMclear();
for (var i = 0; i < 500; i++) {
  EMpush(i);
}
ready

Revisions

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