Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make DS.ManyArray lazy #4600

Merged
merged 1 commit into from
Oct 21, 2016
Merged

make DS.ManyArray lazy #4600

merged 1 commit into from
Oct 21, 2016

Conversation

tchak
Copy link
Member

@tchak tchak commented Oct 19, 2016

This is mostly @igorT typing on my keyboard :)

@igorT
Copy link
Member

igorT commented Oct 19, 2016

We should add a test that verifies it is indeed lazy

};

HasManyReference.prototype.push = function(objectOrPromise) {
return Ember.RSVP.resolve(objectOrPromise).then((payload) => {
return resolve(objectOrPromise).then((payload) => {
var array = payload;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should likely return if the HasManyReference is destroyed by now (assuming it can be destroyed)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have eventually the same problem with belongsTo. I think it's best to create an issue and make a separate PR to fix it (if it's really a problem). I have not changed anything significant in this PR regarding references.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, open an issue and link back here, so we can address.

@igorT
Copy link
Member

igorT commented Oct 20, 2016

Based on measurement this leads to a 15%+ speed improvement when loading hasMany relationships. (one of the scenarios with 5 hasMany's showed a 50% improvement)

@tchak
Copy link
Member Author

tchak commented Oct 21, 2016

@igorT test added

@igorT igorT merged commit 4463dd4 into emberjs:master Oct 21, 2016
@stefanpenner
Copy link
Member

This causes a perf issue and breaking apps using glimmer (which detects this scenario)

Specifically, when a relationship is lazily consumed it should not have side-affects, such as invalidating itself.

POC fix to unblock: #4643, but working on a more comprehensive one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants