Backbone get

JavaScript performance comparison

Revision 5 of this test case created by Drew

Preparation code

<script src='http://code.jquery.com/jquery.js'></script>
<script src='http://underscorejs.org/underscore.js'></script>
<script src='http://backbonejs.org/backbone.js'></script>
 
<script>
Benchmark.prototype.setup = function() {
    var User = Backbone.Model.extend({});
    var user = new User;
    var props = { a: "sth" };
   
    user.set(props);
    user.props = props;
   
    var s;
};
</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
Backbone get

  s = user.get('a');
 
pending…
Backbone attrs

  s = user.attributes.a;
 
pending…
Backbone attrs 2

  s = user.attributes['a'];
 
pending…
native get

  s = user.props.a;
 
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