Skip to content

Building Haddock documentation with Hadrian takes too long

Summary

When a single module of GHC's source code is changed, I expect to be able to render the module's Haddock documentation quickly. But I have only been able to discover one reliable method of rendering the documentation, and it takes 1 minute. For calibration, a full build of GHC on the same machine, from scratch, takes 17 or 18 minutes.

Steps to reproduce, plan A

Here is a method that successfully rebuilds the documentation, but it takes too long:

  1. Build the complete Haddock documentation via

    ./hadrian/build -j _build/docs/html/libraries/index.html
  2. Change a Haddock comment in one module, e.g., compiler/GHC/Driver/Backend.hs

  3. Measure the time needed to rebuild the documentation:

    time ./hadrian/build -j _build/docs/html/libraries/index.html

Expected behavior, plan A

I expected Hadrian to rebuild documentation only for the code that has changed, and for the rebuild to complete in a few seconds at most. (Or realistically, within 7 or 8 seconds, since running Hadrian on an up-to-date tree takes 5 seconds.)

Steps to reproduce, plan B

Here is a method that seems like it ought to rebuild documentation quickly, but it does not actually rebuild the documentation:

  1. Build the complete Haddock documentation via

    ./hadrian/build -j _build/docs/html/libraries/index.html
  2. Change a Haddock comment in one module, e.g., compiler/GHC/Driver/Backend.hs

  3. Attempt to rebuild the documentation for just that module:

    ./hadrian/build _build/docs/html/libraries/ghc/GHC-Driver-Backend.html
    

The documentation is not rebuilt.

Expected behavior, plan B

The same as above: I expected Hadrian to rebuild documentation only for the code that has changed, and for the rebuild to complete in a few seconds at most. (Or realistically, within 7 or 8 seconds, since running Hadrian on an up-to-date tree takes 5 seconds.)

Environment

  • GHC version used: 9.0.2

Optional:

  • Operating System: Debian GNU/Linux 11 (bullseye)
  • System Architecture: x86_64
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information