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

Commit

Permalink
Improve Atom's startup time (#87)
Browse files Browse the repository at this point in the history
* Improve Atom's startup time

Before this change, activation was done on Atom startup, whether or not
you actually had any shell scripts open.

With this change in place, we postpone activation until the Atom
Shellscript grammar's first use.

This improves startup time of my Atom by about 24ms, thus fixing one of
the top startup time offenders according to TimeCop.

For some frame of reference, I have 88 packages installed, and Timecop
lists all packages with startup times above 5ms.
  • Loading branch information
walles authored and Arcanemagus committed Nov 28, 2016
1 parent 342098c commit 539c63f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"engines": {
"atom": ">=1.4.0 <2.0.0"
},
"activationHooks": ["language-shellscript:grammar-used"],
"scripts": {
"test": "apm test",
"lint": "eslint ."
Expand Down
13 changes: 10 additions & 3 deletions spec/linter-shellcheck-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ describe('The ShellCheck provider for Linter', () => {
beforeEach(() => {
atom.workspace.destroyActivePaneItem();

// Info about this beforeEach() implementation:
// https://github.com/AtomLinter/Meta/issues/15
const activationPromise =
atom.packages.activatePackage('linter-shellcheck');

waitsForPromise(() =>
Promise.all([
atom.packages.activatePackage('linter-shellcheck'),
])
atom.packages.activatePackage('language-shellscript').then(() =>
atom.workspace.open(cleanPath))
);

atom.packages.triggerDeferredActivationHooks();
waitsForPromise(() => activationPromise);
});

it('finds nothing wrong with a valid file', () => {
Expand Down

0 comments on commit 539c63f

Please sign in to comment.