Backbone Model Instantiation

JavaScript performance comparison

Test case created by Josh


Test ways to instantiate a Backbone model

Preparation code

<script src="">
<script src="">
Benchmark.prototype.setup = function() {
    var SimpleModel = Backbone.Model.extend();

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');
All at once
var simpleModel = new SimpleModel({
  'a': '1',
  'b': '2',
  'c': '3',
  'd': '4',
  'e': '5',
  'f': '6',

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

Compare results of other browsers


Comment form temporarily disabled.

Add a comment