Improve extension startup performance #408
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following the Microsoft documentation here, I rebuilt the extension's compilation pipeline to use a bundling tool called
esbuild
. This tool shoves all the javascript in the entire project into a single file, which sounds like a terrible idea until you look at this extension host profiler flame graph:Details
500+ms of almost nothing but module importing.
The highest startup time I saw tonight, on my machine was 650ms, and after bundling I'm averaging around 85ms. I have a user that's reported 1400ms startups, and the dev build I sent him cut that down to 630ms.
This cuts the compiled extension down from 796 files and 1.34MB, to 348 files and 295.19KB.
Additionally, this tool does some different linting, which revealed some warnings that I fixed. This extension now compiles with no warnings! (for now...)