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

Scaladoc output size grows to gigabytes with 1000+ input files #18543

Closed
Florian3k opened this issue Sep 12, 2023 · 0 comments · Fixed by #19337
Closed

Scaladoc output size grows to gigabytes with 1000+ input files #18543

Florian3k opened this issue Sep 12, 2023 · 0 comments · Fixed by #19337

Comments

@Florian3k
Copy link
Contributor

Every page generated by Scaladoc (for package, class, object etc...) contains menu on the left, which contains link to every other page. As a result, Scaladoc output size grows quadratically with number of input files.

In case of scala 3 api documentation, with menu it weights ~730MB, without menu less than 200MB. Although this 0.5GB overhead may by acceptable in this case, it gets worse:
Recently tested on 10k+ classes (all rather simple): Scaladoc after about 38 minutes consumed over 140GB of disk space and crashed with java.io.IOException: No space left on device. Without menu it generates ~300MB.

I outline 2 proposed solutions below. They both could be hidden behind a flag, so they would be opt-in.

  1. Solution not involving javascript - iframe
    The menu could be generated once into a file, eg sidemenu.html. This file could be then included in iframe on every page.
    To make the links inside iframe work, we would include <base target="_parent"> in sidemenu.html
    Highlighting current item in menu could be done with a little bit of css and target at the end of iframe url.
    This would probably look a little worse than 2nd solution.

  2. Solution involving javascript
    Serialize menu structure into a file, eg sidemenu.json, load it with JS and render. Links and highlighting work as before.

Since this would be opt-in, I'm leaning towards second solution.

Florian3k added a commit that referenced this issue Jan 16, 2024
Closes #18543 

This PR adds `-dynamic-side-menu` option to Scaladoc.
With this option Scaladoc doesn't generate side menu (packages etc.
tree) in html files. Instead it is serialized into .json file and
rendered on the client using Javascript.
@Kordyjan Kordyjan added this to the 3.4.1 milestone Feb 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants