[erlang-questions] At what point am I "playing compiler"

James Hague james.hague@REDACTED
Mon May 18 19:16:32 CEST 2009


> I take it you didn't benchmark them? expressive_and_efficient() is
> twice as fast as efficient(). I leave it to someone else to try to
> explain why.

The summary function generates--and immediately discards---a three
element tuple for each iteration.  This isn't true of
expressive_and_efficient.  The compiler can generate optimal code for
lists:min, lists:max, and lists:sum.



More information about the erlang-questions mailing list