question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Slow documentation generation

See original GitHub issue

Describe the bug I have noticed that the generation is really slow. Then I have investigated thru VisualVM, and noticed that it is expending most of the time with HTTP requests. Why is that? What is it downloading?

Expected behaviour To be much faster. Do not download anything, since I’m generating a local documentation from local source code.

Screenshots Screenshot 2022-10-08 at 16 41 42

To Reproduce

git clone https://github.com/korlibs/korge.git
./gradlew dokkaHtmlMultiModule

Dokka configuration

Default configuration.

Installation

  • Operating system: macOS
  • Dokka version: 1.7.10

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
soywizcommented, Oct 10, 2022

In my case offline mode was a solution: https://github.com/korlibs/korge/blob/d296abdc2657cd3680efdaa573a3ae38eedb8ea3/build.gradle.kts#L165-L167

But indeed I have the feeling that it is downloading too many things, because it expends several minutes downloading, and now sure why.


BTW also a performance thing (I can open another ticket):

The other thing I noticed is that in Chrome after a few navigations after some time, the performance starts degrading while navigating thru the documentation: https://dokka.korge.org/ It seems that the navigation is setting the html content of the toc everytime the page loads. It seems that Chrome is degenerating not sure why, because firefox and safari seems to handle it reasonably well.

Maybe at some point dokka could use the History API: https://developer.mozilla.org/en-US/docs/Web/API/History_API , when clicking internal links do not fully load the new page but only the content, so the Table of Contents is kept and only updated. In my case the TOC is really huge, so avoiding setting it everytime would be much better in terms of battery.

Alternatively the TOC could be constructed dynamically (it can load the toc html as it is, cache them in the local storage based on the contents hash, and put nodes on demand when opening sections). By profiling I noticed that the problem was when setting the html of the content, and then the browser re-rendering everything (tried to disabled setting the html of the table of contents and fixed the performance issue). Also chrome pseudo-hangs while closing the tab with the korlibs dokka documentation.

https://user-images.githubusercontent.com/570848/194839535-8e8e62ac-94f8-4efc-9682-2d157a832308.mov

1reaction
IgnatBeresnevcommented, Nov 17, 2022

The initial problem with slow network calls seems to have been resolved. I outlined this problem and possible solutions in new documentation, so it should hopefully clear things up.

If you set offlineMode to true, but still want Dokka to generate external links to types from the standard library or JDK (or some other dependency), you can try caching package-lists locally and provide them as file URLs:

import org.jetbrains.dokka.gradle.DokkaTask

tasks.withType<DokkaTask>().configureEach {
    dokkaSourceSets.configureEach {
        externalDocumentationLink {
            packageListUrl.set(
                rootProject.projectDir.resolve("serialization.package.list").toURL()
            )
        }
    }
}

As for the rest of the slowness, I think it’s best to submit individual issues for specific problems. We already have #2699 and #2741 to begin with. So I’ll close this issue for the lack of Definition of Done, but do let us know if you encounter anything else!

Read more comments on GitHub >

github_iconTop Results From Across the Web

[BUG] Documentation Generation is Slow with Large Projects
I have an Angular 2.4 CLI project with 10ish modules and nearly 90 components (and growing!). When I run compodoc, it takes about...
Read more >
Sad ways documentation generation tools suck
Sad ways documentation generation tools suck. My favourite thing to hack is documentation, it is easy to change, it gives the best bang...
Read more >
Python auto-generated documentation — 3 tools that will help ...
Cons of bad documentation? “Out-of-date” documentation can lead to misunderstandings and slower development. 2. Can get fragmented — it's hard ...
Read more >
Is there any logical reason to auto-generate code ...
At my workplace, we have to document everything, and almost always with GhostDoc's auto-generated docs. Do you do this, and are there any...
Read more >
How We Generate Our New Documentation with Sanity & Nuxt.js
How to generate documentation with JavaScript you ask? We used Sanity & Nuxt.js—and we'll show you how we did it!
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found