The cache behaviour of large lazy functional programs on stock hardware

  • Authors:
  • Nicholas Nethercote;Alan Mycroft

  • Affiliations:
  • Cambridge University, United Kingdom;Cambridge University, United Kingdom

  • Venue:
  • Proceedings of the 2002 workshop on Memory system performance
  • Year:
  • 2002

Quantified Score

Hi-index 0.00

Visualization

Abstract

Lazy functional programs behave differently from imperative programs and these differences extend to cache behaviour. We use hardware counters and a simple yet accurate execution cost model to analyse some large Haskell programs on the x86 architecture. The programs do not interact well with modern 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.