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

Optimize style sheets loading #14038

Merged
merged 21 commits into from Mar 22, 2017

Conversation

Projects
None yet
2 participants
@as-cii
Member

as-cii commented Mar 21, 2017

This pull request takes advantage of snapshots auxiliary data to minimize the I/O associated to reading a core package's style sheets when opening Atom. Specifically, we will now store all the sources, digests and style sheet paths in the snapshot blob, so that we can load them all at once during startup and avoid accessing the file system at runtime.

The following is a CPU profile taken on master after merging #14024:

screen shot 2017-03-21 at 09 52 17

If we zoom in the various sections of this profile, we can see that LessCache shows up quite frequently:

screen shot 2017-03-21 at 09 52 50

screen shot 2017-03-21 at 09 53 16

screen shot 2017-03-21 at 09 53 33

After these changes, this is how the same profile looks like:

screen shot 2017-03-21 at 09 56 22

You can notice how Atom now loads ~ 100ms faster thanks to the minimization of the I/O associated with listing and reading less style sheets; this improvement should also make startup time more consistent across reloads because it will make Atom rely less on the file system.

One thing to note is that we will still need to update LessCache and, as a result, write and read from ~/.atom/compile-cache/less when booting up Atom. We could potentially minimize that cost too by batching reads and writes, but we think we could defer this to later and address other concerns (like packages preloading) first.

/cc: @atom/maintainers

as-cii added some commits Mar 7, 2017

Don't load base style sheets in AtomEnvironment
As it will happen again right after package activation.

Signed-off-by: Nathan Sobo <nathan@github.com>
Merge branch 'as-snapshot-atom-environment' into as-ns-optimize-style…
…sheets-loading

# Conflicts:
#	script/package.json
#	script/tdd
#	src/atom-environment.coffee
#	src/context-menu-manager.coffee
#	src/keymap-extensions.coffee
#	src/theme-manager.coffee
#	src/workspace-element.coffee
@nathansobo

This comment has been minimized.

Show comment
Hide comment
@nathansobo

nathansobo Mar 21, 2017

Contributor

⚡️ Goodness keeps rolling in.

Contributor

nathansobo commented Mar 21, 2017

⚡️ Goodness keeps rolling in.

@as-cii as-cii merged commit 5150db2 into master Mar 22, 2017

4 of 5 checks passed

continuous-integration/appveyor/pr AppVeyor build failed
Details
ci/circleci Your tests passed on CircleCI!
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@as-cii as-cii deleted the as-ns-optimize-stylesheets-loading branch Mar 22, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment