Extending Higher-Order Deforestation: Transforming Programs to Eliminate Even More Trees
نویسنده
چکیده
In previous work, we have shown howWadler’s original deforestation algorithm can be extended to handle higher-order programs. A higher-order treeless form of expression was defined to ensure the termination of this algorithm. Our higher-order algorithm was further extended by Seidl and Sørensen, and this extension was shown to remove some intermediate structures not removed by our algorithm (although our algorithm can also remove some intermediate structures not removed by their technique). In this paper, we show how our original algorithm can be further extended to remove the intermediate structures in the examples given by Seidl and Sørensen. We argue that, because our extended algorithm uses an easy to recognise treeless form, there is more transparency for the programmer in terms of the improvements which will be made. Also, unlike the algorithm of Seidl and Sørensen, our extended algorithm is guaranteed to result in no loss of efficiency. We argue that this is essential for any optimisation.
منابع مشابه
Extending Deforestation for First Order functional Programs
Intermediate data structures are widely used in functional programs. Programs which use these intermediate structures are usually a lot easier to understand, but they result in loss of efficiency at run time. In order to reduce these run-time costs, a transformation algorithm called deforestation was proposed by Wadler which could eliminate intermediate structures. However, this algorithm is on...
متن کاملHigher Order Deforestation
Deforestation is a well known transformation algorithm which can eliminate intermediate structures from functional programs. In previous work, we have shown how the deforestation algorithm can be extended to handle higher order programs. A higher order treeless form of expression was defined to ensure the termination of this algorithm. Our higher order algorithm was further extended by Seidl an...
متن کاملFor a Better Support of Static Data Flow
This paper identiies and solves a class of problems that arise in binding time analysis and more generally in partial evaluation of programs: the approximation and loss of static information due to dynamic expressions with static subexpressions. Solving this class of problems yields substantial binding time improvements and thus dramatically better results not only in the case of partial evalua...
متن کاملA Transformation System Combining Partial Evaluation
This paper presents a new approach to optimizing functional programs based on combining partial evaluation and rewriting. Programs are composed of higher-order primitives. Partial evaluation is used to eliminate higher-order functions. First-order rewriting is used to process the transformation. Laws about the higher-order primitives that are relevant for the optimizations are automatically ext...
متن کاملA Transformation System Combining Partial Evaluation with Term Rewriting
This paper presents a new approach to optimizing functional programs based on combining partial evaluation and rewriting. Programs are composed of higher-order primitives. Partial evaluation is used to eliminate higher-order functions. First-order rewriting is used to process the transformation. Laws about the higher-order primitives that are relevant for the optimizations are automatically ext...
متن کامل