Call-pattern specialisation for Haskell programs

  • Authors:
  • Simon Peyton Jones

  • Affiliations:
  • Microsoft Research, Cambridge, United Kingdom

  • Venue:
  • ICFP '07 Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
  • Year:
  • 2007

Quantified Score

Hi-index 0.00

Visualization

Abstract

User-defined data types, pattern-matching, and recursion are ubiquitous features of Haskell programs. Sometimes a function is called with arguments that are statically known to be in constructor form, so that the work of pattern-matching is wasted. Even worse, the argument is sometimes freshly-allocated, only to be immediately decomposed by the function. In this paper we describe a simple, modular transformation that specialises recursive functions according to their argument "shapes". We describe our implementation of this transformation in the Glasgow Haskell Compiler, and give measurements that demonstrate substantial performance improvements: a worthwhile 10% on average, with a factor of 10 in particular cases.