Results 11 - 20
of
20
Constructor specialisation for Haskell programs
, 2007
"... 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 already be in constructor form, so that the work of pattern-matching is wasted. Even worse, the argument is sometimes fres ..."
Abstract
-
Cited by 11 (3 self)
- Add to MetaCart
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 already 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 show that such a transformation has a simple, modular implementation, and that it can be extremely effective in practice, eliminating both pattern-matching and heap allocation. We describe our implementation of this constructor specialisation transformation in the Glasgow Haskell Compiler, and give measurements of its effectiveness.
Using Hindley-Milner Type Inference to Optimise List Representation
- In Proceedings of the ACM Conference on Lisp and Functional Programming. ACM
, 1994
"... Lists are a pervasive data structure in functional programs. The generality and simplicity of their structure makes them expensive. Hindley-Milner type inference and partial evaluation are all that is needed to optimise this structure, yielding considerable improvements in space and time consumption ..."
Abstract
-
Cited by 8 (1 self)
- Add to MetaCart
Lists are a pervasive data structure in functional programs. The generality and simplicity of their structure makes them expensive. Hindley-Milner type inference and partial evaluation are all that is needed to optimise this structure, yielding considerable improvements in space and time consumption for some interesting programs. This framework is applicable to many data types and their optimised representations, such as lists and parallel implementations of bags, or arrays and quadtrees. 1 Introduction Lists are a popular data structure among programmers using strongly-typed functional languages such as ML and Haskell[HdEtAl92]. For this reason, it is important to represent and use them as efficiently as possible. There are a variety of optimisations on simple list representation, and it isn't difficult to think of new ones. The hard problem, and the one solved in this paper, is to automatically infer where an optimised representation can be used. The approach we take can be summari...
Constructed Product Result Analysis for Haskell
"... Compilers for ML and Haskell typically go to a good deal of trouble to arrange that multiple arguments can be passed eciently to a procedure. For some reason, less effort seems to be invested in ensuring that multiple results can also be returned efficiently. In the context ..."
Abstract
-
Cited by 6 (1 self)
- Add to MetaCart
Compilers for ML and Haskell typically go to a good deal of trouble to arrange that multiple arguments can be passed eciently to a procedure. For some reason, less effort seems to be invested in ensuring that multiple results can also be returned efficiently. In the context
The Brisk Machine: A Simplified STG Machine
- 9th International Workshop on the Implementation of Functional Languages, volume 1467 of LNCS
, 1997
"... . This work presents the Brisk Machine, a machine model for the implementation of functional languages. It is especially designed to be flexible and dynamic, so that it can support a uniform and efficient implementation of multiple paradigms such as computational mobility, dynamic loading and linkin ..."
Abstract
-
Cited by 5 (1 self)
- Add to MetaCart
. This work presents the Brisk Machine, a machine model for the implementation of functional languages. It is especially designed to be flexible and dynamic, so that it can support a uniform and efficient implementation of multiple paradigms such as computational mobility, dynamic loading and linking, and logic programming. The Brisk Machine is based on the STG Machine, though its model is simplified and adapted so that the various paradigms it supports can be accommodated easily without interference between them. 1 Introduction Many different machine models have been proposed as intermediate forms in the compilation of functional languages, to act as the target of the front end of compilers and as a starting point for code generation. The resulting models tend to be complicated though, partly due to the effort to optimise them in a particular setting. The Brisk 1 Machine has been designed as a target for Haskell compilation which is flexible enough to support a number of different ...
Unboxing using Specialisation
- Functional Programming
, 1994
"... In performance-critical parts of functional programs substantial performance improvements can be achieved by using unboxed, instead of boxed, data types. Unfortunately, polymorphic functions and data types cannot directly manipulate unboxed values, precisely because they do not conform to the standa ..."
Abstract
-
Cited by 5 (0 self)
- Add to MetaCart
In performance-critical parts of functional programs substantial performance improvements can be achieved by using unboxed, instead of boxed, data types. Unfortunately, polymorphic functions and data types cannot directly manipulate unboxed values, precisely because they do not conform to the standard boxed representation. Instead, specialised, monomorphic versions of these functions and data types, which manipulate the unboxed values, have to be created. This can be a very tiresome and error prone business, since specialising one function often requires the functions and data types it uses to be specialised as well. In this paper we show how to automate these tiresome consequential changes, leaving the programmer to concentrate on where to introduce unboxed data types in the first place. 1 Introduction Non-strict semantics certainly add to the expressive power of a language [8]. Sometimes the performance cost of this extra expressiveness is slight, but not always. It can happen that ...
Implementing the Conjugate Gradient Algorithm in a Functional Language
- In Werner Kluge (Ed.): Implementation of Functional Languages, 8th International Workshop
, 1996
"... . This paper evaluates the elegance and efficiency of functional programming in numerical scientific computing, an interesting area because time and space efficiency are important: many scientific programs work with large data sets and run for a long time. The example we use is the conjugate gradien ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
. This paper evaluates the elegance and efficiency of functional programming in numerical scientific computing, an interesting area because time and space efficiency are important: many scientific programs work with large data sets and run for a long time. The example we use is the conjugate gradient algorithm, an iterative method to solve systems of linear equations. We investigated various implementations of the algorithm in the functional languages Clean and Haskell and the imperative language C. Good results are obtained when comparing the algorithm written in Clean with the same algorithm in C and Haskell. The expressive power of functional programming languages seems to equal to that of traditional imperative languages, while many current compilers produce time- and space-efficient code, using various optimisations including the important update-in-place. Two traditionally weak points of functional language implementations are speed and memory usage, which are very important in n...
Typed Intermediate Languages for Shape-Analysis
- In Typed Lambda Calculi and Applications (TLCA'97), Lecture Notes in Computer Science 1210
, 1997
"... We introduce S2, a typed intermediate language for vectors, based on a 2level type-theory, which distinguishes between compile-time and run-time. The paper shows how S2 can be used to extract useful information from programs written in the Nested Sequence Calculus NSC, an idealized high-level parall ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
We introduce S2, a typed intermediate language for vectors, based on a 2level type-theory, which distinguishes between compile-time and run-time. The paper shows how S2 can be used to extract useful information from programs written in the Nested Sequence Calculus NSC, an idealized high-level parallel calculus for nested sequences. We study two translations from NSC to S2. The most interesting shows that shape analysis (in the sense of Jay) can be handled at compile-time. Introduction Good intermediate languages are an important prerequisite for program analysis and optimization, the main purpose of such languages is to make as explicit as possible the information that is only implicit in source programs (see [18]). A common features of such intermediate languages is an aggressive use of types to incorporate additional information, e.g.: binding times (see [18]), boxed/unboxed values (see [20]), effects (see [23]). In particular, among the ML community the use of types in intermediat...
Efficient Compilation of Functional Languages by Program Transformation
, 1997
"... This article presents how automatic program transformation techniques can be used in a functional language compiler to get significant improvement in the performance of the code generated. The transformations used are simple, but when they are repeatedly applied and interact, they achieve results th ..."
Abstract
- Add to MetaCart
This article presents how automatic program transformation techniques can be used in a functional language compiler to get significant improvement in the performance of the code generated. The transformations used are simple, but when they are repeatedly applied and interact, they achieve results that often are obtained only through specific and more complex transformations. 1 Introduction The compilation of languages by program transformation has been known and studied for many years [5,4,2]. But the study of program transformation techniques specifically for code improvement has often concentrated on computationally expensive transformations, and quite often the resulting effect of these transformations has been studied on small benchmarks, specially suited to reflect the performance improvements presented by the transformation on ideal circumstances, where it will achieve its best results. In this article we present how program transformation techniques have been used to improve th...
Preliminary Proceedings of the ACM SIGPLAN Haskell Workshop (HW'2001)
, 2001
"... Using Haskell as a digital circuit description language, we transform a ripple carry adder that requires O(n) time to add two n-bit words into an e#cient carry lookahead adder that requires O(log n) time. The gain in speed relies on the use of parallel scan to calculate the propagation of carry bits ..."
Abstract
- Add to MetaCart
Using Haskell as a digital circuit description language, we transform a ripple carry adder that requires O(n) time to add two n-bit words into an e#cient carry lookahead adder that requires O(log n) time. The gain in speed relies on the use of parallel scan to calculate the propagation of carry bits e#ciently. The main di#culty is that this scan cannot be parallelised directly since it is applied to a non-associative function. Several additional techniques are needed to circumvent the problem, including partial evaluation and symbolic function representation. The derivation given here provides a formal correctness proof, yet it also makes the solution more intuitive by bringing out explicitly each of the ideas underlying the carry lookahead adder.
Making a Fast Curry
"... Higher-order languages that encourage currying are implemented using one of two basic evaluation models: push/enter or eval/apply. Implementors use their intuition and qualitative judgements to choose one model or the other. ..."
Abstract
- Add to MetaCart
Higher-order languages that encourage currying are implemented using one of two basic evaluation models: push/enter or eval/apply. Implementors use their intuition and qualitative judgements to choose one model or the other.

