Hacker News new | ask | show | jobs
by knowtheory 4767 days ago
I am surprised by your experience, as there are Backbone projects which have used considerably more objects to no ill effect.

Backbone's three major components, Models/Collections, Views and Events do take some planning to coordinate effectively, but that's part of laying out your application.

Also, using bare JS objects is not an anti-pattern in Backbone. Use Models/Collections when you need to manage data, Views when you need to monitor parts of the DOM, and Events to manage messages between your components. Apply as necessary.

P.S. Model.get is literally a single line of bare JS object property access: http://backbonejs.org/docs/backbone.html#section-38 but if you have a lot of events, or validations conditioned to fire on attribute changes, that may effect how long it takes your setters to run (http://backbonejs.org/docs/backbone.html#section-41 )

1 comments

Thanks for the note -- the performance problem was in set(), not get (that was lazy of me).

We didn't have a lot of triggers running -- we spent a lot of time looking at performance traces. Just initializing models on page load was incredibly slow. It was particularly bad on a retina iPad.