Explicitly tell 'getNameToInstances' mods to load
ClosedPublic

Authored by harpocrates on Jul 23 2018, 3:52 PM.

Details

Summary

Calculating which modules to load based on the InteractiveContext means
maintaining a potentially very large GblRdrEnv.

In Haddock's case, it is much cheaper (from a memory perspective) to
just keep track of which modules interfaces we want loaded then hand
these off explicitly to 'getNameToInstancesIndex'.

Diff Detail

Repository
rGHC Glasgow Haskell Compiler
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
harpocrates created this revision.Jul 23 2018, 3:52 PM

Haddock isn't going to build until https://github.com/haskell/haddock/pull/893 gets merged.

This reduces the peak memory usage of Haddock on the ghc library back down to ~1GB from > 2GB before.

alexbiehl accepted this revision.Jul 23 2018, 4:00 PM

Sold. Do I understand correctly, that this is as precise as your previous code but more memory efficient?

This revision is now accepted and ready to land.Jul 23 2018, 4:00 PM

Sold. Do I understand correctly, that this is as precise as your previous code but more memory efficient?

Yes.

This revision was automatically updated to reflect the committed changes.