How do I profile Prelude functions?

Simon Marlow simonmar@microsoft.com
Wed, 19 Mar 2003 12:00:05 -0000


Alistair,

> I can't find advice in the GHC manual on determining how much=20
> time your
> program spends in Prelude functions. I've discovered that I=20
> can alias a
> Prelude function e.g.
>=20
> > import Data.Set
>=20
> ....
>=20
> > myMkSet =3D mkSet
>=20
> ... which will give me a cost-centre for mkMySet. Isn't there=20
> an easier way to do this?

Sorry for the delay in answering your question.

We should really turn on -auto-all when compiling the libraries for
profiling, but we don't for several reasons:

  (a) it affects optimisations
  (b) it makes profiles harder to read
  (c) it makes the libraries a lot larger

these are all things we should fix (well, at least (a) and (b)).  For
(b), we really need a better tool for viewing the profiles: I have a
prototype for such a tool which uses Gtk+HS, which I'll try to
incorporate at some point.

You can of course compile up your own libraries with -auto-all turned
on.  Or alternatively, just use the workaround you discovered.

Cheers,
	Simon