[erlang-questions] Anonymous functions and performance

Michael Turner <>
Sat Nov 5 05:20:51 CET 2011


The full-context Knuth (Hoare/Dijkstra) quote(s):

  http://shreevatsa.wordpress.com/2008/05/16/premature-optimization-is-the-root-of-all-evil/

-michael turner

On Sat, Nov 5, 2011 at 8:41 AM, Jon Watte <> wrote:
> To be fair: the kinds of "premature optimizations" that Knuth was talking
> about when he wrote that were worrying about individual instruction
> selection based on expressions in a high-level program, and/or re-coding
> some statement using inline assembly. Specifically, the quote is prefaced
> with an admonition to ignore "efficiencies in the small" "about 97% of the
> time."
> What he did *not* say was that we should ignore performance altogether -- or
> even that we shouldn't care about performance before and during bring-up of
> our programs. In fact, the point of the article is that you should worry
> about the big performance things first -- I/O, algorithms, data structures.
> Only when all of those are optimal, does it make sense to do small-scale
> optimizations that give you some constant factor of speed-up.
> I recommend you read it; the whole thing. It doesn't say anything like "you
> shouldn't consider overall performance when you're writing code;" rather the
> inverse! Design for performance; implement for clarity.
> Sincerely,
> jw
>
> --
> Americans might object: there is no way we would sacrifice our living
> standards for the benefit of people in the rest of the world. Nevertheless,
> whether we get there willingly or not, we shall soon have lower consumption
> rates, because our present rates are unsustainable.
>
>
>
> On Thu, Nov 3, 2011 at 6:35 PM, Richard O'Keefe <> wrote:
>>
>> On 2/11/2011, at 11:08 PM, Joe Armstrong wrote:
>> > When the great old ones said years ago "Premature optimization
>> > is the root of all evil" - they were using machines that by todays
>> > standards were
>> > incredibly slow. Even then they viewed premature optimization as evil.
>>
>>
>> Mind you, premature pessimisation isn't a good idea.
>> I'm in the middle of a, um, discussion about the marking of two
>> student projects.  Both of them involved comparing the performance
>> of some algorithms.  Both of them had code that was a factor of
>> 4 to 6 *thousand* times slower than straightforward C.  I think
>> that this makes their results meaningless, or at any rate useless,
>> and that a project with such results deserves a low mark.  On the
>> other side it is argued that these are well presented projects...
>>
>> Straightforward code using straightforward data structures is the aim.
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> 
>> http://erlang.org/mailman/listinfo/erlang-questions
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
>



More information about the erlang-questions mailing list