Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to profile Haskell after compiler optimizations?

Tags:

haskell

ghc

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.

like image 590
RichardW Avatar asked Jan 30 '26 07:01

RichardW


1 Answers

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

like image 158
Noughtmare Avatar answered Feb 02 '26 01:02

Noughtmare