[Haskell-cafe] GHC optimisations

Andrew Coppin andrewcoppin at btinternet.com
Mon Aug 13 14:51:06 EDT 2007

Stefan O'Rear wrote:
> On Mon, Aug 13, 2007 at 07:35:31PM +0100, Andrew Coppin wrote:
>> (I once compiled a program that used the GHC API. The final binary was 
>> several times larger than ghc.exe...)
> GHC is a particularly bad case because what it does is determined by the
> settings of a bunch of switches in the configuration data.  Of course,
> GHC isn't smart enough to perform inter-module control flow analysis, so
> even with -split-objs you'd probably still link most of GHC.

Is it likely that GHC will ever become "smart enough" to do that kind of 
analysis? (I imagine this is going to be especially fun with precompiled 

>>> This is called the Constructed Product Return (CPR) analysis, and it
>>> applies to all types with one constructor (in archaic jargon, product
>>> types).
>> Right. So it doesn't have to have strict fields or anything? Just has to 
>> have exactly one constructor?
> Yep, CPR is completely independent of strictness, however the returned
> product must be *new*, since returning an old object by value risks
> losing sharing (and thus creating large memory leaks).

Right, OK.

More information about the Haskell-Cafe mailing list