Backbone.js Collection iteration
JavaScript performance comparison
Preparation code
<script src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.1/underscore-min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.0/backbone-min.js"></script>
<script>
Benchmark.prototype.setup = function() {
var M = Backbone.Model.extend({ });
var Col = Backbone.Collection.extend({
model: M
});
var a = new Array(5000);
var c = new Col(a);
};
</script>
Preparation code output
Test runner
Warning! For accurate results, please disable Firebug before running the tests. (Why?)
Java applet disabled.
| Test | Ops/sec | |
|---|---|---|
Backbone each |
|
pending… |
for loop with collection.at |
|
pending… |
for loop with collection.models |
|
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:
- Revision 1: published by Mike Frey
- Revision 2: published
- Revision 3: published
- Revision 4: published
- Revision 5: published
- Revision 6: published
- Revision 7: published
- Revision 8: published
0 comments