[Haskell-cafe] Optmiization of recursion

Fergus Henderson fjh-mailbox-18 at galois.com
Mon Oct 4 13:22:13 EDT 2004

On 04-Oct-2004, Jon Cast <jcast at ou.edu> wrote:
> Fergus Henderson <fjh-mailbox-18 at galois.com> held forth:
> > If analyzing the performance and space usage of your programs is
> > important, then Haskell may not be the best choice of language.
> I disagree.  If performance and space usage are sufficiently important,
> Haskell may not be best.  But it's really not that much easier to
> analyze performance or space usage under strict languages.

You're welcome to your opinion, but I don't agree; I find it much easier
to analyze performance and space usage for strict languages.

> In either case, the golden rule is: profile.  Reading the source code will tell
> you very little.

Profiling can only tell you about the costs for a finite set of test
cases.  If you want to write robust and reliable programs, you need to
analyze the worst-case memory usage, and that requires looking at the
code, not just profiling.  Of course, you can try to find a representative
test set which will exercise the worst-case behaviour, but that task of
determining which tests will exercise the worst-case behaviour will itself
requires analysis of the code.  That analysis is IMHO much more difficult
in lazy languages.

Fergus J. Henderson                 |  "I have always known that the pursuit
Galois Connections, Inc.            |  of excellence is a lethal habit"
Phone: +1 503 626 6616              |     -- the last words of T. S. Garp.

More information about the Haskell-Cafe mailing list