Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to profile compilation time per module with GHC?

Tags:

haskell

ghc

I think everything's in the title, but to give more context. We have two 70+ packages whose compilation times are pretty different: One takes twice as much time as the other (without taking into account parallelization). I would like to know which modules take the most time in order to have a better understanding of what is causing this discrepancy.

like image 567
insitu Avatar asked Nov 22 '17 21:11

insitu


1 Answers

GHC can output per-module timing data nowadays when you build with -ddump-to-file -ddump-timings. This causes files with the extension .dump-timings to be written in your build directories (generally .stack-work for Stack and dist-newstyle for Cabal).

I wrote a tool to find all these files and visualize them: https://github.com/codedownio/time-ghc-modules.

like image 74
tom Avatar answered Nov 15 '22 08:11

tom