[Haskell-cafe] Re: does the compiler optimize repeated calls?
lennart at augustsson.net
Wed Sep 6 08:47:51 EDT 2006
Furthermore, doing that optimization (common subexpression
elimination) can lead to space leaks. So you should not count on the
compiler doing it. Besides, I often find it more readable and less
error prone to name a common subexpression; only one place to change
when you need to change the call.
On Sep 6, 2006, at 08:38 , Stephane Bortzmeyer wrote:
> [Warnings: newbie and not having tested or read the generated assembly
> On Wed, Sep 06, 2006 at 09:32:07AM -0300,
> Alex Queiroz <asandroq at gmail.com> wrote
> a message of 18 lines which said:
>> I am a newbie myself (second week of learning Haskell), but I'll
>> give it a shot: Since functions have no side effects, the compiler
>> executes the function only once.
> Sure, "pure" programming languages *allow* the compiler to perform
> such optimizations but it does not mean it is *actually* done
> (promises are cheap but writing compiler code is expensive).
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
More information about the Haskell-Cafe