[Haskell-cafe] Why does my module take so long to compile?

Troels Henriksen athas at sigkill.dk
Mon Feb 15 15:14:52 UTC 2021


I have a program with about 220 modules.  One of these modules takes
_much_ longer to compile than the others (several minutes longer).  I
don't understand why.  It compiled much faster with GHC 8.8.3, but got
orders of magnitude slower when I changed to GHC 8.10.2.  I don't
understand why, since I don't think there is nothing special about the
module - e.g. no type-level programming.

Is there any good way to "profile" the stack or cabal compilation
process to at least get an intuition for what takes so long?  Note that
the module is in the middle of the dependency tree of my program, so it
is not viable to separate it out and compile it manually with GHC.  It's
slow even when I pass '--fast' to stack which should disable the
optimiser, so I guess the type checker may be spending a lot of time on
handling the admittedly large amount of typeclass constraints I have on
some of my definitions.

I'm mostly looking for techniques and tools I can also use next time
this problem occurs, not the specific problem here, but if anyone's
curious, the module in question is this one:
https://github.com/diku-dk/futhark/blob/master/src/Futhark/Pass/ExtractKernels/DistributeNests.hs

-- 
\  Troels
/\ Henriksen


More information about the Haskell-Cafe mailing list