Skip to content

Size of resulting documentation with many container elements (e.g. class fields) #2995

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

Open
bsutton opened this issue Mar 24, 2022 · 12 comments
Labels
area-output-size Issues related to dartdoc's sometimes unreasonable output size. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-performance Issues related to slow dartdoc generation.

Comments

@bsutton
Copy link

bsutton commented Mar 24, 2022

I'm trying to work out f I'm doing something wrong.
I'm generating docs using dartdoc and the size of the resulting doc directory is huge.
I'm using dartdoc 5.0.1 from pub.dev.

I'm running:
dartdoc --no-validate-links --output $pathToDocRoot --no-show-progress

I've seen dartdoc generate directories that are 23GB in size.

I'm hoping I'm doing something wrong.

As an example, the iconify_flutter package version 0.0.3 is 18MB tar.gz (I thought pub.dev limited uploads to 10MB?).
After running dartdoc the resulting doc/api directory is: 11GB

It also takes an extreme amount of time:
Documented 111 public libraries in 17569.5 seconds

This is on a AMD® Ryzen 7 3700x 8-core processor × 16 with 32GB ram and SSDs on linux.

@srawlins
Copy link
Member

😮 That... sounds too large, haha. And also a ton of time. I'll take a look at iconify_flutter.

@srawlins srawlins added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) P2 A bug or feature request we're likely to work on labels Mar 24, 2022
@parlough
Copy link
Member

I haven't taken a look, but I think this goes back to the issue of a large amount of members each having their own file. A package with that that many icon sets is bound to have a lot.

See #1983

@srawlins
Copy link
Member

I think we want to make a change where members, like static consts, which do not have a doc comment, don't get a page.

I think in the case of this package we see this scary growth: A library with a class with n members will generate O(n) files, each of which has a sidebar of length O(n), resulting in a total of O(n2) bytes.

@bsutton
Copy link
Author

bsutton commented Mar 24, 2022

This package certainly has a lot of static consts and generates 109K files.

It has one directory with 11K files.

The fact that it takes 5 hours to generate is also rather problematic.

To be clear this isn't a one-off occurrence. We are seeing these sorts of numbers for many packages.

@parlough
Copy link
Member

parlough commented Mar 24, 2022

I think we want to make a change where members, like static consts, which do not have a doc comment, don't get a page.

I think in the case of this package we see this scary growth: A library with a class with n members will generate O(n) files, each of which has a sidebar of length O(n), resulting in a total of O(n2) bytes.

Sounds like a good idea to me. There's a few things to consider though, such as if it may break external expectations of where member links would be, as these would be exceptions.

@bsutton
Copy link
Author

bsutton commented Mar 24, 2022

#1983 also discussed iframes for the TOC and such which I think would be a valuable idea.

@srawlins
Copy link
Member

I wonder if something has been fixed here, in terms of the time. It just took me 2080 seconds at HEAD to document iconify_flutter.

@srawlins
Copy link
Member

The size is not fixed though:

$ du -sh doc/
 82G    doc/
$ du -sh lib/
 80M    lib/

@bsutton
Copy link
Author

bsutton commented Mar 25, 2022

I just did a run without the --no-validate-links which seem to run much faster but that doesn't make sense as I would have thought the no validate option would be faster.

@srawlins
Copy link
Member

Yeah maybe you got them backwards? I "just" tried without --no-validate-links and took 19624.1 seconds. 💀 💀 💀

@bsutton
Copy link
Author

bsutton commented Mar 25, 2022 via email

@srawlins srawlins changed the title Size of resulting documentation Size of resulting documentation with many container elements (e.g. class fields) Mar 25, 2022
@srawlins srawlins added type-performance Issues related to slow dartdoc generation. area-output-size Issues related to dartdoc's sometimes unreasonable output size. labels Mar 25, 2022
@srawlins
Copy link
Member

I did some size benchmarking, and it does look either quadratic or even cubic. :/

In generating docs for 1 package with 1 library with 1 class with N methods with 1 parameter each:

method count kbytes of output ms to validate
1 164 329
10 240 433
100 1434 1067
1000 60416 24293
4000 930816 369820
8000 3670016 1460461
10000 5767168 2776674

Google Sheets gives a quadratic regression for the output size as: 1845 + -0.727x + 0.0576x^2 with R^2=1.

Google Sheets gives a quadratic regression for the validation time as: 22516 + -70.9x + 0.0338x^2 with R^2=0.994.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-output-size Issues related to dartdoc's sometimes unreasonable output size. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) type-performance Issues related to slow dartdoc generation.
Projects
None yet
Development

No branches or pull requests

3 participants