Emberdata- Choking on large data , CPU going upto 60% and also taking too much memory


#1

I am using a simple hasMany relationship here is my code.

App.MyModel:DS.Model.extend({
name: DS.attr(‘string’),
Children:DS.hasMany(‘App.MyModel’,{defaultValue: []})
})

I dont want to load hasMany at the first go , i want to load the children when i click on the parent . Her is my json for parent…

[{id:‘1’, _title:‘Parent’}]

And now on the click of the parent i am doing this…

> this.get(‘content.Children’).find();

which goes to the findHasMany of my adapter…()

findHasMany: function(store, record, relationship, details) {
///Here goes my ajax call and on success i do this
store.loadMany(App.MyMode, data);
store.loadHasMany(record, relationship.key, data.getEach(‘id’));
//this pirticuler line take too much of memory and cpu(loading around 5000 data)
}

Got stuck with this …