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

Pathological view teardown performance #12016

Closed
ef4 opened this issue Aug 8, 2015 · 8 comments
Closed

Pathological view teardown performance #12016

ef4 opened this issue Aug 8, 2015 · 8 comments
Labels
Milestone

Comments

@ef4
Copy link
Contributor

ef4 commented Aug 8, 2015

I started investigating this last night but haven't had a chance to finish, so I'm posting the issue in case anybody else sees this or wants to dig in.

@chadhietala created a repo that reproduces this issue. When you toggle between the routes, you'll see a massive delay.

The problem is somewhere in the legacy childViews support. The "controller:before" and "controller:after" actions are firing over 1.1 million times each during the render.

@stefanpenner stefanpenner added this to the 1.13.x milestone Aug 8, 2015
@runspired
Copy link
Contributor

1.1million times o.O that's on a scale I'm not used to hearing.

@stefanpenner
Copy link
Member

worst case, we can special case teardown. But this legacy stuff may be causing grief in other areas as well.

@asakusuma
Copy link
Contributor

Did some digging. I don't think these two functions can co-exist, at least in their current state:

_legacyControllerDidChange: observer('controller', function() {
this.walkChildViews(view => view.notifyPropertyChange('controller'));
}),
_notifyControllerChange: on('parentViewDidChange', function() {
this.notifyPropertyChange('controller');
})

For the repro repo, if you get rid of _notifyControllerChange, you don't have million function calls. Trying to figure out if we can just axe one of them.

@runspired
Copy link
Contributor

_legacyControllerDidChange: observer('controller', function() {
    this.walkChildViews(view => view.notifyPropertyChange('controller'));
  }),

I think if you can't axe this, the answer is wrapping this method in an if legacy clause if possible. Seems like _notifyControllerChange is dependent on an event that wouldn't be present in the legacy case.

@asakusuma
Copy link
Contributor

@runspired yea I've separately tried having each function check to make sure the other doesn't exist, haven't found anything that still passes this test:

QUnit.test('controller property should be inherited from nearest ancestor with controller', function() {

The first 4 assertions are fine, it's the last 4 that don't pass. Yo @tomdale, git blame implicates you on both the code and the tests, got any ideas?

@ryanlitalien
Copy link

@runspired @asakusuma For my app, I was having an issue with the view coming in as undefined. Error: Uncaught TypeError: Cannot read property 'notifyPropertyChange' of undefined.

I removed the walkChildViews function as @runspired hinted at, and the route transitions were successful. I'm using Ember 2.0.1. I'm not sure what else I could provide to assist in this issue, please let me know.

_legacyControllerDidChange: _emberMetalMixin.observer('controller', function () { }),

@asakusuma
Copy link
Contributor

@ryanlitalien if you can figure out a way to fix the issue and have the tests still pass, that would be awesome. I tried the change you mentioned 3 weeks ago and it broke tests.

@rwjblue
Copy link
Member

rwjblue commented Dec 2, 2015

#12414 fixed the issue reported here

@rwjblue rwjblue closed this as completed Dec 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants