The cache behaviour of large lazy functional programs on stock hardware
Lazy functional programs behave differently from imperative program and these differences extend to cache behaviour. We use hardware counters and a simple yet accurate execution cost model to analyse some large Haskell program on the x86 architecture. The programs do not interact well with modem processors-L2 cache data miss stalls and branch misprediction stalls account for up to 60% and 32% of execution time respectively, Moreover, the program code exhibits little exploitable instruction-level. parallelism. We then use simulation to pinpoint cache misses at the instruction level. With this information we apply prefetching to minimise the cost of write misses, speeding up Haskell programs by up to 22%. We conclude with more ideas for changing the Glasgow Haskell Compiler and its garbage collector to improve the cache performance of large programs.
hardware counters haskell branch misprediction glasgow haskell compiler cache measurement cache simulation