[Haskell] Excessive sharing and GHC

Daan Leijen daan at cs.uu.nl
Tue Oct 18 18:01:07 EDT 2005


John Meacham wrote:
> On Tue, Oct 18, 2005 at 08:31:19AM +0100, Simon Peyton-Jones wrote:
>> GHC tries not to create space leaks, but does not guarantee not to.  In
>> particular, the full laziness transformation is so beneficial most of
>> the time that, even though it can create a space leak GHC still does it
>> (unless you turn it off with a flag).
> 
> I was thinking it would be nice if one could put a pragma on CAFs that
> basically made ghc treat them as WHNF so it would float them inward as
> far as possible including inside lambdas. in particular, constant
> strings that are created (cheaply) from efficient internal
> representations should not be held onto in their inefficient form.

What about adding a unit argument? That would do the trick without pragmas.

All the best,
-- Daan

> it might even be worth it to have a pragma that made ghc think they
> were duplicatable too, so it would float them all the way to each of their
> uses, duplicating the expression as necessary just to make sure it is
> never held onto more than needed.
> 
>         John
> 



More information about the Haskell mailing list