Skip to content

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

Closed
@Florian3k

Description

@Florian3k

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions