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

Commit

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

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

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

This improves startup time of my Atom by about 100ms, fixing one of the top startup time offenders according to TimeCop.
  • Loading branch information
walles authored and Arcanemagus committed Nov 18, 2016
1 parent 66cf745 commit 84d70dc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"engines": {
"atom": ">=1.9.0 <2.0.0"
},
"activationHooks": ["language-python:grammar-used"],
"configSchema": {
"executablePath": {
"type": "string",
Expand Down
17 changes: 10 additions & 7 deletions spec/linter-flake8-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ describe('The flake8 provider for Linter', () => {
const lint = require('../lib/main.js').provideLinter().lint;

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

waitsForPromise(() =>
Promise.all([
atom.packages.activatePackage('linter-flake8'),
atom.packages.activatePackage('language-python'),
]).then(() =>
atom.workspace.open(goodPath)
)
);
atom.packages.activatePackage('language-python').then(() =>
atom.workspace.open(goodPath)));

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

it('should be in the packages list', () =>
Expand Down

0 comments on commit 84d70dc

Please sign in to comment.