[Haskell-cafe] Cyclic Inclusions

Thomas Davie tom.davie at gmail.com
Wed Aug 13 07:29:39 EDT 2008

On 13 Aug 2008, at 13:18, ajb at spamcop.net wrote:

> G'day all.
> Quoting Thomas Davie <tom.davie at gmail.com>:
>> To be honest, ghc compiles things so fast (at least on any of
>> my systems) that I couldn't care less if it took 10 times as long  
>> (I would
>> however like some added convenience for that time spent)
> Have you ever compiled GHC itself?  Just curious what you'd think  
> about
> a 10x speed hit there.
On the machine I'm sat at now, it takes 20 minutes.  Secondly, you  
would *only* pay the speed penalty when you had cyclic includes, and  
you didn't use the flag to use an hi-boot file, so it would continue  
to take 20 minutes.

> If it helps, think about the lifetime of a program.  If you assume  
> that
> a program grows linearly over time, and that recompilations occur at
> a roughly constant rate, it follows that the time spent recompiling
> is O(n^2).  Constant factors matter.
But the penalty would be no where near that big -- unless you happened  
to have *all* your modules depend on *all* other modules.

>> If I compile a module on which lots of other modules depend,
>> I have to do lots of recompilation... If I compile a module which  
>> is in
>> a cyclic dependancy group, I have to do lots of recompilation,  I  
>> don't
>> see that there's a difference here.
> If you only change the implementation of a module, not its interface,
> you don't need to recompile anything that imports it.  (At least, this
> is true at -O0, which if you care about fast recompilation because
> you're deep in development, you're probably doing.)

Well, if this turned out to take a long time, then I'd probably switch  
to writing an hi-boot file... Something that I wouldn't have to waste  
time doing at all if it happened that ghc was still "fast enough"  
without providing one.


More information about the Haskell-Cafe mailing list