Is there a way to profile compile time for a module using GHC?

I think everything is in the title, but to give more context. We have two 70+ packages whose compilation time is slightly different: one takes twice as much time as the other (excluding parallelization). I would like to know which modules take the most time in order to better understand what causes this mismatch.

+5
source share
1 answer

Not sure if you mean 70+ packages or 70+ modules, but anyway ...

I cannot think of any particularly simple way to do this. You can try the time when the GHC writes its messages to the console; I'm not sure how accurate this is. Otherwise, I think you will need to figure out the correct compilation order and manually call GHC to compile one module at a time, and also use the OS level tools in time, how long each compilation command will take. (Perhaps a GXC function to automatically create a Makefile might help ...)

You can compile GHC itself with profiling enabled, but I don't think this helps in this case. (And that is quite a bit of work.)

FWIW, I would also like to know why some modules take a little eternity to compile, while others almost instantly ...

0
source

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


All Articles