-
Notifications
You must be signed in to change notification settings - Fork 45
Improve Atom startup time #276
Improve Atom startup time #276
Conversation
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. For some frame of reference, I have 90 packages installed, and Timecop lists all packages with startup times above 5ms.
Note that when running the specs locally, |
Unfortunately to properly test locally you need the |
atom.packages.activatePackage('language-python')); | ||
|
||
waitsForPromise(() => | ||
atom.workspace.open(goodPath)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just move this as a .then
on the above Promise.
@@ -12,14 +12,22 @@ describe('The flake8 provider for Linter', () => { | |||
const lint = require('../lib/main.js').provideLinter().lint; | |||
|
|||
beforeEach(() => { | |||
// This whole beforeEach function is inspired by: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I want this on every repo, maybe just update AtomLinter/Meta#15 with a link to that discussion?
Also, sorry I hadn't helped out on the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there 😉.
) | ||
); | ||
atom.packages.activatePackage('language-python').then(() => | ||
waitsForPromise(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The waitsForPromise
on L20 is already waiting on the parent of this, just return the open()
, eg:
waitsForPromise(() =>
atom.packages.activatePackage('language-python').then(() =>
atom.workspace.open(goodPath)
)
);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just waiting on CI now.
Break if you use a different python syntax like Python Django or MagicPython: #280 |
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.
For some frame of reference, I have 90 packages installed, and Timecop
lists all packages with startup times above 5ms.