Ember vs Backbone Filtering

JavaScript performance comparison

Revision 5 of this test case created

Preparation code

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.3/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.9/backbone-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.1/handlebars.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.rc.1/handlebars.min.js"></script>
<script src="http://cloud.github.com/downloads/emberjs/ember.js/ember-1.0.0-pre.2.min.js"></script>
<script>
Benchmark.prototype.teardown = function() {
    App.collection = [];
};
</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
EmberJS
 App = Ember.Application.create();
 var dataList = [];

 for (var index = 0; index < 5000; index++) {
   dataList.push(Ember.Object.create({
     number: index,
     isOdd: (index % 2 == 0)
   }));
 }

 App.collection = Ember.ArrayController.create({
   content: dataList
 });
 var items = App.collection.get('content').filterProperty('isOdd', true);
pending…
BackboneJS
var dataList = [];
for (var index = 0; index < 5000; index++) {
  dataList[dataList.length] = new Backbone.Model({
    number: index,
    isOdd: (index % 2 == 0)
  });
}

var collection = new Backbone.Collection();
collection.add(dataList);

var items = collection.filter(function(model) {
  return model.get('isOdd') === true;
});
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