Skip to content

Reduce web bundle size #10307

@rebornix

Description

@rebornix

Currently the unzipped bundle size for Web bits is 4.67MB. Considering that the web extension doesn't support bundle splitting, a large bundle file means long download and evaluation (activation).

image

There have been quite some good efforts to reduce the bundle size. We can follow the same patterns and also leverage the eslint rules to ensure that we don't overlook them in the future. From a 10000 feet bird view, we can do at least following to bring down the bundle size noticeably:

  • Load lodash function modules only Avoid loading full lodash #10308
  • Mark moment.js as external as it's not used by us, or jupyterlab sub-components we depend on
  • semver is used for Python intepreter and Python extension versions check, we probably don't need this in Web. If so, make sure we are not referecing semver in Web related code paths
  • hash. We use sha1, sha256, sha512 only, no need to reference them all. Also we can validate if we need all three sha algorithms.
  • fnv. Originally introduced for A/B testing in Python db297c4. The code sets the default algorithm to fnv and now it's used as default way to generate file hash https://github.com/microsoft/vscode-jupyter/blob/main/src/kernels/jupyter/preferredRemoteKernelIdProvider.ts#L55
    • To move off fnv, we would need a migration plan to move from fnv to simpler hashes as sha512.
  • External/Ideas
    • Load sub modules from jupyterlab/services instead of the whole bundle
    • Replace url-parse with inhouse vscode.Uri.parse

Metadata

Metadata

Labels

debtCode quality issues

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions