-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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
Explore lazy code loading #164068
Comments
Some simple experiments that I am trying to do in October
|
I have done the following experiment
In step two I have removed all In step three I have removed many
1 some editor contribution still end up in the bundle because they are referenced by other workbench contributions Finding, learnings, observations
|
Not necessarily. AMD is a dead horse but it can do all of this - the only thing that will be simpler with ESM is tree-shaking on a module-level, e.g identify unused module exports and drop them. We do have a custom bundler which we need to blow the dust off that and maybe re-learn how it works. A tricky thing from the past was knowing how to bundle, e.g some modules are used everywhere and those should be in the initial bundle and not be repeated in subsequent bundles. In the past we realised that most things were in the initial bundle and that contributions were super tiny. That's what might us drop the whole approach. However, by now we have plenty more contributions and this might start to pay off. |
We are now down the rabbit hole exploring to migrate from AMD to ESM. While this isn't needed to do bundling and lazy code loading we will benefit from being able to reuse existing bundlers (instead of rolling our own AMD-based solution). I am snowplowing this for now, if there is urgent need for code splitting: the |
As VS Code has grown larger and more featureful, so does the main bundle size that increases the time it takes to load/parse/compile the JS linearly. This isn't an issue for anything not in main bundle (shared proc, exthost, ptyhost, built-in extensions, etc.), but code for features like the terminal, tasks and the welcome page are all loaded in even if they are not used yet.
We have had various discussions about this in the past which I don't think are documented anywhere. Here are some of the things discussed and a brain dump of other thoughts on the topic:
The section after will reduce some, but I believe that is the code that is run in the top level which is mostly registering contributions which will need to remain in the main bundle.
LifecyclePhase.Eventually
as it will speed up startupcommon/
cannot depend onbrowser/
) and high level folders (base/
cannot depend onplatform/
)The text was updated successfully, but these errors were encountered: