Skip to content
This repository was archived by the owner on Mar 3, 2023. It is now read-only.

Wait for themes to load before measuring - #3519

Merged
kevinsawicki merged 5 commits into
masterfrom
ks-remeasure-after-themes-load
Sep 11, 2014
Merged

kevinsawicki merged 5 commits into
masterfrom
ks-remeasure-after-themes-load

Conversation

@kevinsawicki

Copy link
Copy Markdown
Contributor

While profiling I noticed that EditorComponent::onStylesheetsChanged was 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 👀

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.
@kevinsawicki
kevinsawicki force-pushed the ks-remeasure-after-themes-load branch from 83677e0 to dc5eb95 Compare September 11, 2014 22:32

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

onStylesheetsChanged takes a stylesheet, no? All the events above this emit with the stylesheet object.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

what about removing this? It should have the same effect due to the return unless atom.themes.isInitialLoadComplete() check in onStylesheetsChanged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When things are reloaded (theme refresh) this measurement will happen as well.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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.

@benogle

benogle commented Sep 11, 2014

Copy link
Copy Markdown
Contributor

Crazy.

Comment thread src/editor-component.coffee Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

stylesheet? for consistency?

@benogle

benogle commented Sep 11, 2014

Copy link
Copy Markdown
Contributor

Seems fine

kevinsawicki added a commit that referenced this pull request Sep 11, 2014
Wait for themes to load before measuring
@kevinsawicki
kevinsawicki merged commit ea6f124 into master Sep 11, 2014
@kevinsawicki
kevinsawicki deleted the ks-remeasure-after-themes-load branch September 11, 2014 23:22
@benogle benogle mentioned this pull request Sep 30, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants