haskellghc

How to profile Haskell after compiler optimizations?


I have a fairly complex and performance-critical Haskell program. I have used cost center profiling to optimize to the point where there are no major remaining hot spots. Furthermore, the program runs about 15x faster with -O2 (and no profiling) than it does with stack build --profile, so I have doubts as to whether the cost center profiler is helping much at all with finding bottlenecks that remain post-optimization.

What are my options for finding hot spots that remain after optimization? I am aware of ticky-ticky profiling, but it is described in the docs as not for "mere mortals", and I am a mere mortal.


Solution

  • Since GHC 9.4.1 you can use the -fprof-late flag to have the compiler add automatic cost centre annotations after optimizations.