profiling experience

Serge D. Mechveliani mechvel at
Fri Dec 8 04:03:50 EST 2006

On Wed, Dec 06, 2006 at 03:21:23PM +0000, Kirsten Chevalier wrote:
> On 12/6/06, Serge D. Mechveliani <mechvel at> wrote:
> >What may consitute this strange CAF cost of 96% ?
> >
> >Kirsten Chevalier <catamorphism at>
> >wrote
> >> I didn't look at your code all that carefully, but did you build the
> >> GHC libraries with "-prof -auto-all"? (Not just "-prof".) If you don't
> >> build the libraries with "-auto-all", then cost centres won't get
> >> inserted for library functions, and if it's really a standard library
> >> function that's taking all of that time, the profiling report won't
> >> indicate that.
> >
> >I made ghc-6.6 from the official source in a standard way:
> >
> >  ./configure ...;  make;  make install
> >
> >Does this presume that this also generates the .p.o GHC library versions
> >for -prof -auto-all ?
> >
> No; you must have built the profiling libraries (i.e., building the
> libraries with -prof), otherwise you wouldn't have been able to
> compile your code for profiling. But, building the profiling libraries
> in the standard way doesn't add "-auto-all" to the compile flags. So
> if you want to build the libraries with "-auto-all", do:
> make EXTRA_HC_OPTS=-auto-all

Thank you. I am trying this.
One could ask, why the GHC installation does not apply  -auto-all  
by default?

> but be careful! As I said in my previous message, adding cost centres
> disables some optimizations, so the profiling results you get from
> this may not be accurate with respect to what would happen if you ran
> your code after building it with -O and no profiling.

In my example, -O makes the run 2 times faster, and the profiling time 
per-cents are shown the same as for -Onot. I suspect that this particular 
invilisible time eater will present independently on -O flag and on
the cost centers.

Serge Mechveliani
mechvel at

More information about the Glasgow-haskell-users mailing list