Angular VS Ember (v42)

Revision 42 of this benchmark created on


Preparation HTML

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

<script>
window.getId = function(idx) {
    var d = Date.now() + "";
    return idx + "-" + d.substring(d.length - 6);
};
</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.4.0/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 -------->

<!-------- 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/ember.js/1.12.1/ember-template-compiler.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ember.js/1.12.1/ember.min.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 < 50; i++) {
  ANG.$scope.push(i);
}
ANG.$scope.$apply();
ready
Ember
EMclear();
for (var i = 0; i < 50; i++) {
  EMpush(i);
}
ready
Angular : change data
ANG.$scope.clear();
for (var i = 0; i < 50; i++) {
  ANG.$scope.push(getId(i));
}
ANG.$scope.$apply();
ready
Ember : change data
EMclear();
for (var i = 0; i < 50; i++) {
  EMpush(getId(i));
}
ready

Revisions

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