I upgraded backbone.js from 0.5.3 to 0.9.2, and I noticed a significant decrease in speed in my application. The application processes many large collections and adds a large number of models at certain points. In any case, from 0 to 600 models are added. In version 0.5.3, the sortedIndex function was most often used for 12% of the CPU. in version 0.9.2, the code became much slower, and the sortBy function took up 70% of the CPU.
I suspect that they add all models by sorting them, rather than adding each model to where it should contain the collection sort. Is there a flag that I can use to use the old method or any other way to speed it up. I understand that I can implement my own collection class specific to my large datasets, but I would prefer to stick with basic collections right now.
Here is the comparator of the collection
comparator: function(model) {
return model.get("timestamp");
}
Thanks in advance
source
share