Skip to content
This repository was archived by the owner on Aug 3, 2024. It is now read-only.

Accumulate explicitly which modules to load for 'attachInstances' #893

Merged
merged 1 commit into from
Aug 21, 2018

Conversation

harpocrates
Copy link
Collaborator

The old approach to fixing #469, while correct, consumes a lot of
memory. We ended up with a HUGE GblRdrEnv in ic_rn_gbl_env. However,
getNameToInstancesIndex takes that environment and compresses it down
to a much smaller ModuleSet.

Now, we compute that ModuleSet explicitly as we process modules. That
way we can just tell getNameToInstancesIndex what modules to load
(instead of it trying to compute that information from the interactive
context).

The old approach to fixing haskell#469, while correct, consumes a lot of
memory. We ended up with a HUGE 'GblRdrEnv' in 'ic_rn_gbl_env'. However,
'getNameToInstancesIndex' takes that environment and compresses it down
to a much smaller 'ModuleSet'.

Now, we compute that 'ModuleSet' explicitly as we process modules. That
way we can just tell 'getNameToInstancesIndex' what modules to load
(instead of it trying to compute that information from the interactive
context).
@harpocrates
Copy link
Collaborator Author

Relevant issue: #462.

This won't build without GHC side changes to getNameToInstancesIndex: https://phabricator.haskell.org/D5003.

This reduces the peak memory usage of Haddock on the ghc library back down to ~1GB from > 2GB before. It basically fixes the memory regression in deddced (see this comment for graphs). Here is what the new graph looks like:

screen shot 2018-07-23 at 2 00 25 pm

@alexbiehl
Copy link
Member

Now we have both! Precise instances and more efficient memory usage!

@harpocrates
Copy link
Collaborator Author

Ping? Is there no hope of this making it into 8.6?

@alexbiehl
Copy link
Member

Hmmm. https://phabricator.haskell.org/D5003 hasn't been merged yet. Ping @bgamari

@bgamari
Copy link
Collaborator

bgamari commented Aug 21, 2018

@alexbiehl in general I can't merge this sort of thing until the Haddock patch has merged. Afterall, otherwise I can't bump the submodule.

@bgamari bgamari merged commit b3770d8 into haskell:ghc-head Aug 21, 2018
@harpocrates harpocrates deleted the get-name-to-instances branch October 16, 2018 20:03
hubot pushed a commit to ghc/ghc that referenced this pull request May 17, 2024
…nstances

Accumulate explicitly which modules to load for 'attachInstances'
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants