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.
- Denis Bechet. Limix: a partial evaluator for partially static structures. Technical report, INRIA, 1994.Google Scholar
- Manuel Chakravarty, Roman Leshchinskiy, Simon Peyton Jones, and Gabriele Keller. Data Parallel Haskell: a status report. In ACM Sigplan Workshop on Declarative Aspects of Multicore Programming, Nice, January 2007. Google Scholar
Digital Library
- Duncan Coutts, Roman Leshchinskiy, and Don Stewart. Stream fusion: from lists to streams to nothing at all. In ACM SIGPLAN International Conference on Functional Programming (ICFP'07), Freiburg, Germany, October 2007a. ACM. Google Scholar
Digital Library
- Duncan Coutts, Don Stewart, and Roman Leshchinskiy. Rewriting Haskell strings. In Practical Aspects of Declarative Languages (PADL'07), pages 50--64. Springer-Verlag, January 2007b. Google Scholar
- Neil D. Jones, Carsten K. Gomard, and Peter Sestoft. Partial Evaluation and Automatic Program Generation. Prentice Hall, 1993. Google Scholar
Digital Library
- Torben Mogensen. Partially static structures in a self-applicable partial evaluator. In Partial Evaluation and Mixed Computation, 1988.Google Scholar
- Simon L. Peyton Jones, Andrew Tolmach, and Tony Hoare. Playing by the rules: rewriting as a practical optimisation technique in GHC. In Ralf Hinze, editor, 2001 Haskell Workshop. ACM SIGPLAN, September 2001.Google Scholar
- S. L. Peyton Jones and J. Launchbury. Unboxed values as first class citizens. In R. J. M. Hughes, editor, ACM Conference on Functional Programming and Computer Architecture (FPCA'91), volume 523 of Lecture Notes in Computer Science, pages 636--666, Boston, 1991. Springer. Google Scholar
Digital Library
- S. L. Peyton Jones and A. Santos. A transformation-based optimiser for Haskell. Science of Computer Programming, 32 (1-3): 3--47, September 1998. Google Scholar
Digital Library
- S. L. Peyton Jones, W. D. Partain, and A. Santos. Let-floating: moving bindings to give faster programs. In ACM SIGPLAN International Conference on Functional Programming (ICFP'96). ACM Press, Philadelphia, May 1996. Google Scholar
Digital Library
- Peter Thiemann. Higher-order redundancy elimination. In ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM '94), pages 73--83, Orlando, Florida, June 1994. ACM.Google Scholar
- Peter Thiemann. Avoiding repeated tests in pattern matching. In Gilberto Filé, editor, 3rd International Workshop on Static Analysis, number 724 in Lecture Notes in Computer Science, pages 141--152, Padova, Italia, September 1993. Springer Verlag. ISBN 3-540-57264-3. Google Scholar
Index Terms
Call-pattern specialisation for Haskell programs
Recommendations
Call-pattern specialisation for Haskell programs
ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programmingUser-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 ...
The Intel labs Haskell research compiler
Haskell '13The Glasgow Haskell Compiler (GHC) is a well supported optimizing compiler for the Haskell programming language, along with its own extensions to the language and libraries. Haskell's lazy semantics imposes a runtime model which is in general difficult ...
The Intel labs Haskell research compiler
Haskell '13: Proceedings of the 2013 ACM SIGPLAN symposium on HaskellThe Glasgow Haskell Compiler (GHC) is a well supported optimizing compiler for the Haskell programming language, along with its own extensions to the language and libraries. Haskell's lazy semantics imposes a runtime model which is in general difficult ...







Comments