Slow glimmer rendering with simple auth

Hi,

I am transitioning my app to octane, and it started to move really slow. I am not an expert with glimmer, but it looks like it renders the page even when nothing is changed.

I noticed that every 500ms ember simple auth tries checks the cookie. For some reason this loop, triggers a render for glimmer.

I am using ember 3.16.3 and ember simple auth 3.0.0

Is there a way to trace which properties are triggering this rendering?

I captured some performance profiles, maybe you can understand more than me.

https://gitlab.com/GISCollective/help-desk/uploads/bf5b204a9a8392c045c570f46d5d45af/chrome-Profile-20200311T001335.json

https://gitlab.com/GISCollective/help-desk/uploads/6d26bcc277ad18d238aa5c0f7ce046af/firefox_profile.json

Thanks, Bogdan

Note that i haven’t dug into the profiles at all—

The first thing you should look for is the use of observers in your codebase. Interop with observers comes at a pretty high cost, especially for synchronous observers. See RFC #0494 for some details.

Thanks for the reply!

I already removed all the observers from the project, and I get no linter errors. I have no other idea what can cause this problem…

Is it possible that this kind of code to impact glimmer performance?

https://github.com/simplabs/ember-simple-auth/blob/master/addon/session-stores/cookie.js#L271

Thanks, Bogdan

I looked into the ember code, and I understood that the controller query params are implemented using observers. In the route setup method the addQueryParamsObservers method is called which creates a new observer for each parameter.

https://github.com/emberjs/ember.js/blob/v3.16.3/packages/@ember/-internals/routing/lib/system/route.ts#L913

Is there a way to avoid observers here?

You might want to check out this link and contribute to the discussion:

https://github.com/emberjs/ember.js/issues/18715

It sounds like this might be caused by this: https://github.com/emberjs/ember.js/issues/18715

TLDR: Using @tracked with query params can lead to major performance issues. The only fix for now is to not use @tracked for them, but set().

Could that be the case for you?

Yes! this is it!

Thanks! I will remove all the @tracked attributes from my query params for now.