Skip to content
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

Request only a single JS bundle from index.ts #931

Merged
merged 1 commit into from
Jun 19, 2024

Conversation

CryZe
Copy link
Collaborator

@CryZe CryZe commented Jun 19, 2024

We introduce a new indexDelayed.ts file that bundles all the imports that are used in the index.ts file. They are not imported directly there, because we want to keep the size of the index.html as small as possible, so it can focus on requesting the WASM file as soon as possible. This should result in the indexDelayed.ts bundle containing basically all the JS. This JS bundle and the WASM file should then be requested in parallel. While it would be possible to request these all individually over in the index.ts, browsers don't actually like doing too many requests in parallel and it turns out that big JavaScript files actually compress better than having many small ones. The WASM file also is pretty big, so ideally we are not bottlenecked by the large JS file. If necessary, we could do some more bundle splitting for stuff that isn't used until much later, like the Markdown library.

@CryZe CryZe added the performance Performance is suboptimal and should be improved. label Jun 19, 2024
We introduce a new `indexDelayed.ts` file that bundles all the imports
that are used in the `index.ts` file. They are not imported directly
there, because we want to keep the size of the `index.html` as small as
possible, so it can focus on requesting the WASM file as soon as
possible. This should result in the `indexDelayed.ts` bundle containing
basically all the JS. This JS bundle and the WASM file should then be
requested in parallel. While it would be possible to request these all
individually over in the `index.ts`, browsers don't actually like doing
too many requests in parallel and it turns out that big JavaScript files
actually compress better than having many small ones. The WASM file also
is pretty big, so ideally we are not bottlenecked by the large JS file.
If necessary, we could do some more bundle splitting for stuff that
isn't used until much later, like the Markdown library.
@CryZe CryZe merged commit e897dd8 into LiveSplit:master Jun 19, 2024
1 check passed
@CryZe CryZe deleted the big-js-bundle branch June 19, 2024 18:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
performance Performance is suboptimal and should be improved.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant