Test backbone collection speed

JavaScript performance comparison

Revision 3 of this test case created

Preparation code

<script type="text/javascript" src="https://rawgithub.com/documentcloud/backbone/master/test/vendor/jquery.js"></script>
<script type="text/javascript" src="https://rawgithub.com/documentcloud/backbone/master/test/vendor/underscore.js"></script>
<script type="text/javascript" src="https://rawgithub.com/documentcloud/backbone/master/backbone.js"></script>
<script type="text/javascript">
window.BackboneMaster = Backbone.noConflict();
</script>


<script type="text/javascript" src="https://rawgithub.com/caseywebdev/backbone/no-temp/backbone.js">
</script>
<script type="text/javascript">
window.BackboneSpeedup = Backbone.noConflict();


/* have to use smaller than 65533 collection because otherwise master code will fail */
var source = [];
for (var i = 3; i < 65536; i++) {
  source.push({
    id: i
  });
}
/* Large source */
var largeSource = [];
for (var i = 3; i < 500000; i++) {
  largeSource.push({
    id: i
  });
}
</script>
<script>
Benchmark.prototype.setup = function() {
    var speedupCollection = new BackboneSpeedup.Collection();
    var masterCollection = new BackboneMaster.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
Master collection.reset
masterCollection.reset(source);
pending…
Speedup collection.reset
speedupCollection.reset(source);
pending…
Master collection.add
masterCollection.add(source);
pending…
Speedup collection.add
speedupCollection.add(source);
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