Haskell: debugging long compilation times on stack projects

I am currently using Stack to create a project that has about 80 modules and 13,000 lines of code. Currently, compilation takes about 3 minutes for minor changes in my type files, which is unacceptable - this prevents me from quickly testing my code through the ghci stack. It also significantly slows down a number of things: for example, pair programming with peers or consultations with specialists.

I would like to know why compilation takes so long and what I can do to speed it up. Is there a way to profile compile time?

Also, how can I determine if it is a slow stack or ghc?

I know about installing -O0, although it doesn't seem to help compile time. I also know that TemplateHaskell and Typeclass Resolution may take some time - is there a way to get a better resolution on how long they take?

Note: I have seen speed up compilation in GHC , but this has been since 2013, and hdevtools does not currently work with my setup.

+4
source share
1 answer

If this question still matters, you can try the following:

stack ghci --fast --no-build --ghc-options="-fbyte-code" 

IIRC, using this, gave me the fastest results with stack ghci .

If this does not help, you can look in the direction of --ghc-options="-dshow-passes" . I am also looking in that direction now to try to speed up the / ghci-reload build.

+1
source

Source: https://habr.com/ru/post/1273591/


All Articles