School of Computing

Common Subexpressions are Uncommon in Lazy Functional Languages

Olaf Chitil

In Chris Clack, Tony Davie, and Kevin Hammond, editors, Proceedings of the 9th International Workshop on Implementation of Functional Languages (September 1997), pages 182-196. St Andrews, Scotland, Springer, 1998.


Common subexpression elimination is a well-known compiler optimisation that saves time by avoiding the repetition of the same computation. In lazy functional languages, referential transparency renders the identification of common subexpressions very simple. More common subexpressions can be recognised because they can be of arbitrary type whereas standard common subexpression elimination only shares primitive values. However, because lazy functional languages decouple program structure from data space allocation and control flow, analysing its effects and deciding under which conditions the elimination of a common subexpression is beneficial proves to be quite difficult. We developed and implemented the transformation for the language Haskell by extending the Glasgow Haskell compiler. On real-world programs the transformation showed nearly no effect. The reason is that common subexpressions whose elimination could speed up programs are uncommon in lazy functional languages.

Download publication 170 kbytes (PDF)

Bibtex Record

author = {Olaf Chitil},
title = {{Common Subexpressions are Uncommon in Lazy Functional Languages}},
month = {unknown},
year = {1998},
pages = {182-196},
keywords = {determinacy analysis, Craig interpolants},
note = {},
doi = {},
url = {},
    booktitle = {Proceedings of the 9th International Workshop on Implementation of Functional Languages (September 1997)},
    publisher = {Springer},
    publication_type = {inproceedings},
    submission_id = {20829_1083667238},
    other_year = {1997},
    organization = {St Andrews, Scotland},
    editor = {Chris Clack and Tony Davie and Kevin Hammond},

School of Computing, University of Kent, Canterbury, Kent, CT2 7NF

Enquiries: +44 (0)1227 824180 or contact us.

Last Updated: 21/03/2014