afeld / backbone-nested

A plugin to make Backbone.js keep track of nested attributes - looking for maintainers! https://github.com/afeld/backbone-nested/issues/157
https://afeld.github.com/backbone-nested/
MIT License
445 stars 83 forks source link

_setAttr function performance issue for large dataset #162

Open dpmragu opened 7 years ago

dpmragu commented 7 years ago

I have a model which contains the nested model( like 3 l sub level).When this model has large dataset it takes a lot of time to finish execution. I found that the _setAttr function, especially the following code, take a long time for execution in the backbone-nested.js

following lines take a long time for execution in the backbone-nested.js file.

for (var a in obj) { if (obj.hasOwnProperty(a)) { nestedAttr = prefix + '.' + a; nestedVal = obj[a]; if (!_.isEqual(model.get(nestedAttr), nestedVal)) { model._delayedChange(nestedAttr, nestedVal, opts); } if (_.isObject(nestedVal)) { checkChanges(nestedVal, nestedAttr); } } }``

Could you please help me to resolve this issue?