Parallel --make (GHC build times on newer MacBook Pros?)

Evan Laforge qdunkan at gmail.com
Sat Sep 3 03:05:46 CEST 2011


>> Another way to do this would be to have GHC --make invoke itself to
>> compile each module separately.  Actually I think I prefer this method,
>> although it might be a bit slower since each individual compilation has
>> to read lots of interface files.  The main GHC --make process would do
>> the final link only.  A fun hack for somebody?
>
> this would also help building large libraries on architectures with
> little memory, as it seems to me that when one ghc instance is compiling
> multiple modules in a row, some leaked memory/unevaluated thunks pile up
> and eventually cause the compilation to abort. I suspect that building
> each file on its own avoids this issue.

In my experience, reading all those .hi files is not so quick, about
1.5s for around 200 modules, on an SSD.  It gets worse with a pgmF, since ghc
wants to preprocess each file, it's a minimum of 5s given 'cat' as a
preprocessor.

Part of my wanting to use make instead of --make was to avoid this
re-preprocessing delay.  It's nice that it will automatically notice
which modules to recompile if a CPP define changes, but not so nice
that it has to take a lot of time to figure that out every single
compile, or for a preprocessor that doesn't have the power to change
whether the module should be recompiled or not.



More information about the Glasgow-haskell-users mailing list