> What does this mean CAF ?
The CAF cost centres are explained in detail in the new profiling
documentation, which is bundled with the 4.07 pre-release.
> The last two lines of the second table show that 0.994 of time and
> 0.993 of allocations was spent by the center "length n!".
> This looks natural.
>
> But what means the first table? Why "sum" is skipped there?
The first table only lists cost centres that contribute more than a certain
amount to the overall costs (> 1% I think).
> Does it show that the Garbage Collection has taken 0.244 of the
> total time?
Yes. It's really a bug that GC shows up in the first table, because the
other percentages are calculated as "percentage of time spent doing non-GC
work". That's why the percentages add up to more than 100%.
> GC can be caused by many values. To find out which part of GC is
> caused by the given item f, we have to look at the %alloc part for
> f in the second table.
Calculating GC cost is a complicated task. The number of GC's done is
affected by the allocation rate of the program, so doing less allocation
will result in fewer GC's. However, the cost of each GC is proportional to
the amount of live data in the heap at that moment in time, so reducing the
live data (eliminating space leaks) is likely to have a more dramatic effect
on the runtime. Use GHC's heap profiler to examine the live data profile of
the program.
Cheers,
Simon