GHC memory usage when typechecking from source vs. loading ModIfaces

ÉRDI Gergő gergo at erdi.hu
Mon Feb 10 11:56:34 UTC 2025


On Mon, 10 Feb 2025, Matthew Pickering wrote:

> I wonder if you have got your condition the wrong way around. 
> 
> The only "safe" time to perform rehydration is AFTER the point it can never be used
> again.
> 
> If you rehydrate it just before it is used then you will repeat work which has already
> been done. If you do this, you will always have a trade-off between space used and
> runtime.

Oops. Yes, I have misunderstood the idea. I thought the idea was that 
after loading a given module into the HPT, its ModDetails would start 
out small (because of laziness) and then keep 
growing in size as more and more of it are traversed, and thus 
forced, during the typechecking of its dependees, so at some point we 
would want to reset that into the small initial representation as created 
by initModDetails.

But if the idea is that I should rehydrate modules when they can't be used 
anymore, then that brings up the question why even do that, instead of 
straight removing the HomeModInfos from the HPT?


More information about the ghc-devs mailing list