This PR does several things to drastically reduce Haddock's memory usage. The high-level changes are described in the commit messages.
I have been testing these changes on the Agda codebase with a version of Haddock that is compiled with a GHC version that has been patched to further reduce Haddock's memory usage. With a non-patched GHC and haddock 9.6, the maximum residency is about 1.1GB with the following profile:
With these patches and the patched GHC, the maximum residency is about 580MB with the following profile:
Note the reduction in running time as well.
On the Agda codebase, there are no diffs in the generated HTML documentation.
I'll do my best to annotate this PR with comments describing the changes.
This PR does several things to drastically reduce Haddock's memory usage. The high-level changes are described in the commit messages.
I have been testing these changes on the Agda codebase with a version of Haddock that is compiled with a GHC version that has been patched to further reduce Haddock's memory usage. With a non-patched GHC and haddock 9.6, the maximum residency is about 1.1GB with the following profile:
With these patches and the patched GHC, the maximum residency is about 580MB with the following profile:
Note the reduction in running time as well.
On the Agda codebase, there are no diffs in the generated HTML documentation.
I'll do my best to annotate this PR with comments describing the changes.