Tip for profiling GHC

Matthew Pickering matthewtpickering at gmail.com
Sat Aug 24 20:00:41 UTC 2019


Hi all,

I thought for a long while that if you wanted to profile GHC itself
then you had to
build a profiled version of HEAD. However, this isn't true.

The easiest way to profile GHC itself is to write a simple GHC API
application and compile that
with profiling. Normal GHC distributions come with profiling versions
of the ghc library so you can use this to profile released versions of
the compiler.

For example, here is a simple program that Andreas created when I
suggested he did this.

https://gist.github.com/mpickering/e13f343f2b35b51693d15582180b1c02

You can specify whatever options you want to start the session, you
might imagine compiling a package with cabal and copying the command
line flags from there in order to set up a session correctly.

Cheers,

Matt


More information about the ghc-devs mailing list