Article View: comp.lang.functional
Article #97Re: ** LAZY LANGUAGES FASTER?? **
From: Thomas M. Breuel
Date: Tue, 28 Jul 1992 20:01
Date: Tue, 28 Jul 1992 20:01
32 lines
2221 bytes
2221 bytes
In article <farrell.712286497@coral.cs.jcu.edu.au> farrell@coral.cs.jcu.edu.au (John Farrell) writes:
*Non-strict* evaluation saves time by not evaluating arguments which are not
needed. *Lazy* evaluation saves time by evaluating each argument at most once.
Eager evaluation evaluates each argument exactly once.
It is the mechanism by which lazy evaluation is implemented which slows it
down. The speedup due to not evaluating arguments is often negligible because
mostly people don't write functions which don't use their arguments.
I think there are two views towards strict evaluation in a purely
functional framework:
(1) it constrains the program, letting the compiler generate
better code (a constant factor speedup)
(2) it affects the semantics of functions in the presence of
errors and non-termination
Mostly what I care about is (1). I care about (2) only when I am
debugging. Therefore, for debugging, I want strict evaluation. For
using my code, I want the most efficient evaluation possible.
Usually, I suspect that will be strict evaluation, but on parallel
machines, it could be something else.
Altogether, it therefore seems prudent to write programs so that they
depend as little as possible on whether the language is strict, eager,
non-strict, or lazy. But if it came down to a choice, I'd suspect that
eager evaluation is a practical necessity for many applications, and
languages should provide it at least in some form.
Thomas.
Technical Details
Message-ID:
<TMB.92Jul28160101@arolla.idiap.ch>Path:
arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!destroyer!gumby!yale!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmbReferences:
<1992Jul24.134857.23289@gdstech.grumman.com> <3737@svin02.info.win.tue.nl> <farrell.712286497@coral.cs.jcu.edu.au>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!elroy.jpl.nasa.gov!usc!sol.ctr.columbia.edu!destroyer!gumby!yale!mintaka.lcs.mit.edu!ai-lab!life.ai.mit.edu!tmb From: tmb@arolla.idiap.ch (Thomas M. Breuel) Newsgroups: comp.lang.functional Subject: Re: ** LAZY LANGUAGES FASTER?? ** Message-ID: <TMB.92Jul28160101@arolla.idiap.ch> Date: 28 Jul 92 20:01:01 GMT References: <1992Jul24.134857.23289@gdstech.grumman.com> <3737@svin02.info.win.tue.nl> <farrell.712286497@coral.cs.jcu.edu.au> Sender: news@ai.mit.edu Reply-To: tmb@idiap.ch Organization: IDIAP (Institut Dalle Molle d'Intelligence Artificielle Perceptive) Lines: 32 In-reply-to: farrell@coral.cs.jcu.edu.au's message of 28 Jul 92 01:21:37 GMT