We started this chapter by profiling programs by cost centres, which can be set automatically (-fprof-auto
) or manually (SCC-annotations). We learned that there is overhead in profiling, which is why execution times are an inaccurate metric when profiling. Allocations remained a good measure of performance in any case. We used the heap profiler to produce informative graphs about memory usage over time, and to spot unwanted allocations and retainers.
We explored different options in the GHC heap profiler: break-downs and subset selections, both of which draw more or less from the same pool of parameters. The default break-down was by cost not yet finished.
Finally, we looked at two additional libraries, criterion
for benchmarking and ekg
for monitoring. In discussing criterion, we stumbled upon the concept of normal form, which will also come up later on when we discuss parallelism. Adding real-time graphical garbage garbage collector monitoring via HTTP to a Haskell application was...