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

Ensure optimal page download size #84

Open
certik opened this issue Apr 6, 2023 · 0 comments
Open

Ensure optimal page download size #84

certik opened this issue Apr 6, 2023 · 0 comments

Comments

@certik
Copy link
Contributor

certik commented Apr 6, 2023

According to this "The average optimal weight per page is approximately 1–1.5 MB, but in general, this value should not exceed 3 MB."

To get a better understanding of the numbers, the httparchive.org website has a nice graph of webpage sizes of over a million top sites:

Screen Shot 2023-04-05 at 7 23 39 PM

According to that, most pages are now between 1-4.5 MB.

I think our goal should be to keep the total download of https://dev.lfortran.org/ under 3MB. That puts as well within the range of most websites, a little bit on the upper end, but still well within the range, and it seems consistent with the first recommendation above as well.

I am guessing there is around 0.5MB of download of the website itself, so that leaves 2.5MB for lfortran.wasm and the runtime library data. I think we should include any runtime library inside lfortran.wasm itself for easier distribution.

Currently the latest lfortran.wasm is about 5.1MB. Our oldest lfortran.wasm was about 2.6MB.

I think to keep the size low, the default lfortran.wasm should:

  • contain LFortran compiled in Release mode (done)
  • only include parser, semantics, the WASM backend (so remove x86, c/cpp, julia, etc. backends)
  • only include the ASR passes needed for Debug build that the WASM backend needs.
  • for example the verify() pass can be removed, since it is not used in the LFortran Release mode. Most optimization passes can be removed

This can be configured in cmake, to select what parts of LFortran one wants to build. We have to see if the above brings the size down enough. If it doesn't, then we need to investigate what is causing the size to be large, it could be the size of asr.h and templates, so we will have to think how to rearrange things to keep the size small. But first I would do the above, which are low handing fruits.

Later we can have a thin/minimal lfortran.wasm (2.5MB) and then lfortran-full.wasm (larger). For now I would just focus on the minimal version and get the website to work well with it and be lean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant