Backbone Model Instantiation

JavaScript performance comparison

Test case created by Josh

Info

Test ways to instantiate a Backbone model

Preparation code

<script src="//documentcloud.github.io/underscore/underscore-min.js">
</script>
<script src="//documentcloud.github.io/backbone/backbone-min.js">
</script>
<script>
Benchmark.prototype.setup = function() {
    var SimpleModel = Backbone.Model.extend();
};
</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
one at a time
var simpleModel = new SimpleModel();
simpleModel.set('a', '1');
simpleModel.set('b', '2');
simpleModel.set('c', '3');
simpleModel.set('d', '4');
simpleModel.set('e', '5');
simpleModel.set('f', '6');
pending…
All at once
var simpleModel = new SimpleModel({
  'a': '1',
  'b': '2',
  'c': '3',
  'd': '4',
  'e': '5',
  'f': '6',
});
pending…

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

Compare results of other browsers

0 comments

Add a comment