I'm having a speed issue on my Backbone app during the endless scrolling event; models are added to a collection individually, and so the collection is sorted every time. I'm wondering how I can optimize this and have 2 solutions:
- Cache them and add them to the collection in bulk, merging 20 sorts into 1
- Silently adding the models to the collection, and debouncing the call I make to sort during each add (so only one call is made in the end)
So I'm wondering if 2 is even possible, as it would be easier to implement, and if there is a better solution I'm not thinking of. Thanks!