Jon Mountjoy wrote:
> Is CSE very useful for Haskell programs?
> 
> I would guess 'sometimes'.  In some cases of course is it, but in
> other cases you might increase the scope of an expression and thereby
> worsen the space behaviour.  Have there been any attempts to
> identify/quantify this?

See my paper:

Common Subexpressions are Uncommon in Lazy Functional Languages

Abstract:
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.

See:
http://www-i2.informatik.rwth-aachen.de/~chitil/PUBLICATIONS/comSubsElimLncs.dvi.gz
or
http://www-i2.informatik.rwth-aachen.de/~chitil/PUBLICATIONS/comSubsElimLncs.ps.gz


It will appear soon in:
Chris Clack, Tony Davie and Kevin Hammond (eds.): Proceedings of the 9th
 International Workshop on Implementation of Functional Languages, St. Andrews,
Scotland, September 10th-12th 1997, LNCS, Springer.


Olaf

-- 
OLAF CHITIL, Lehrstuhl fuer Informatik II, RWTH Aachen, 52056 Aachen, Germany
             Tel: (+49/0)241/80-21212; Fax: (+49/0)241/8888-217
             URL: http://www-i2.informatik.rwth-aachen.de/~chitil/


Reply via email to