-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
DEV: Improve built-in browser performance marks/measurements #26758
Conversation
- Rename `discourse-booted` to 'discourse-init' (because 'booted' makes it sound like boot was finished. When in fact, it was just starting) - Introduce `discourse-paint`, which is fired after the Ember application has been painted to the screen by the browser. This happens slightly after DOMContentLoaded - Add a `performance.measure` call to link those two marks, so they're easily visible in performance traces Also removes an ember boot-order workaround which is no longer required.
let element = document.querySelector( | ||
`meta[name="discourse/config/environment"]` | ||
); | ||
const config = JSON.parse( | ||
decodeURIComponent(element.getAttribute("content")) | ||
); | ||
const event = new CustomEvent("discourse-booted", { detail: config }); | ||
const event = new CustomEvent("discourse-init", { detail: config }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not entirely sure where this is used but do we need to maintain backwards compatibility here in case there are plugins or themes relying on this event?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll need to update discourse-client-performance, yeah. I'm not aware of anything else relying on it.
- discourse-init is a direct replacement for the old discourse-booted metric. - discourse-paint is a new metric which tells us when the Discourse UI is actually rendered to the screen Ref discourse/discourse#26758
- discourse-init is a direct replacement for the old discourse-booted metric. - discourse-paint is a new metric which tells us when the Discourse UI is actually rendered to the screen Ref discourse/discourse#26758
Rename
discourse-booted
to 'discourse-init' (because 'booted' makes it sound like boot was finished. When in fact, it was just starting)Introduce
discourse-paint
, which is fired after the Ember application has been painted to the screen by the browser. This happens slightly after DOMContentLoadedAdd a
performance.measure
call to link those two marks, so they're easily visible in performance tracesAlso removes an ember boot-order workaround which is no longer required.