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

Troels Henriksen athas at sigkill.dk
Mon Feb 15 17:03:11 UTC 2021


Henning Thielemann <lemming at henning-thielemann.de> writes:

> On Mon, 15 Feb 2021, Troels Henriksen wrote:
>
>> 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.
>
> Does the problem persist with GHC-8.10.4?

Yes.  I'll try with GHC 9.10.1 once my dependencies catch up.

> I would try to out-comment parts of the module and watch when
> compilation becomes faster.

I will try that.  I also noticed that other modules are affected as
well, although to a lesser degree, and by passing
'--ghc-options=-dshow-passes' I obtained this information:

!!! Desugar [Futhark.Pass.ExtractKernels.DistributeNests]: finished in 255448.24 milliseconds, allocated 363811.623 megabytes

So apparently the "desugar" pass takes over four minutes.  Apart from
lowering Haskell into Core, what exactly does this pass do that is so
expensive?  The following Simplifier passes take almost no time in
comparison.

-- 
\  Troels
/\ Henriksen


More information about the Haskell-Cafe mailing list