Repository navigation
Wait for themes to load before measuring - #3519
Conversation
Instead of measuring on each stylesheet load at startup, wait for the initial load of all the stylesheets to complete and then do the necessary measurments.
83677e0 to
dc5eb95
Compare
There was a problem hiding this comment.
onStylesheetsChanged takes a stylesheet, no? All the events above this emit with the stylesheet object.
There was a problem hiding this comment.
what about removing this? It should have the same effect due to the return unless atom.themes.isInitialLoadComplete() check in onStylesheetsChanged
There was a problem hiding this comment.
When things are reloaded (theme refresh) this measurement will happen as well.
There was a problem hiding this comment.
what about removing this?
isInitialLoadComplete is only true after the last add event fires, so the onStylesheetsChanged would never pass that test for editors at startup without listening to onDidReloadAll.
There was a problem hiding this comment.
onStylesheetsChanged takes a stylesheet, no?
Updated to guard against that, instead of adding a second method that duplicates the onStylesheetsChanged method except for that check.
There was a problem hiding this comment.
When things are reloaded (theme refresh) this measurement will happen as well.
That is okay right? Theme refreshing has never been super fast anyway so I figured one extra call wasn't a big deal at all.
|
Crazy. |
There was a problem hiding this comment.
stylesheet? for consistency?
|
Seems fine |
Wait for themes to load before measuring
While profiling I noticed that
EditorComponent::onStylesheetsChangedwas called around 25 times, as each theme stylesheet was loaded, taking a total 200-300 milliseconds, when an editor was open at startup.Now the component waits for the initial theme load to complete before measuring so it is only called once at startup and removes 200-300 millseconds from startup time when an editor is open.
/cc @nathansobo and @benogle for 👀