Hi,
I have a question about coding and compilers. Suppose that a function
is invoked with the same parameters inside another function declaration, eg
-- this example does nothing particularly meaningless
g a b c = let something1 = f a b
something2 = externalsomething (f a b) 42
something3 = externalsomething2 (137 * (f a b)) in
...
Does it help (performancewise) to have
g a b c = let resultoff = f a b
something2 = externalsomething resultoff 42
something3 = externalsomething2 (137 * resultoff) in
...
or does the compiler perform this optimization? More generally, if a
function is invoked with the same parameters again (and it doesn't
involve anything like monads), does does it makes sense
(performancewise) to "store" the result somewhere?
Thank you,
Tamas
PS: I realize that I am asking a lot of newbie questions, and I would
like to thank everybody for their patience and elucidating replies.
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe