From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,a65bb7bde679ed1d X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,UTF8 Received: by 10.205.138.133 with SMTP id is5mr690620bkc.0.1322779752276; Thu, 01 Dec 2011 14:49:12 -0800 (PST) Path: y3ni20845bkw.0!nntp.google.com!news2.google.com!goblin2!goblin.stu.neva.ru!aioe.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Natasha Kerensikova Newsgroups: comp.lang.ada Subject: Re: Ann: Natools.Chunked_Strings, beta 1 Date: Thu, 1 Dec 2011 22:49:11 +0000 (UTC) Organization: A noiseless patient Spider Message-ID: References: <4ed4fc37$0$2537$ba4acef3@reader.news.orange.fr> Mime-Version: 1.0 Injection-Date: Thu, 1 Dec 2011 22:49:11 +0000 (UTC) Injection-Info: mx04.eternal-september.org; posting-host="Mda950WjNwNLAFOE7yJXQw"; logging-data="9889"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JWF7eG7f+dM3hbuxvoh9R" User-Agent: slrn/0.9.9p1 (FreeBSD) Cancel-Lock: sha1:KdXAhMdn7VMyAL5v8pv0VBSW4kA= Xref: news2.google.com comp.lang.ada:14781 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Date: 2011-12-01T22:49:11+00:00 List-Id: On 2011-12-01, Yannick DuchĂȘne wrote: > Le Thu, 01 Dec 2011 20:07:09 +0100, Jeffrey Carter > a Ă©crit: >> The evil of premature optimization is the waste of effort when the >> optimization is unnecessary. > Or also when optimization is at the cost of clarity (optimized > implementation is often less easy to understand and more error prone, as > it involves special cases everywhere). That's what also I understood as "evil": when a trade-off between optimization and clarity or simplicity or cleanness is shifted early towards optimization. I don't consider a waste of time or effort as "evil", only "bad" or "stupid". To reach the level of "evil" to my eyes, it needs to be still costly after being unmasked as evil. In the example here, in the case where I have a genuine performance problem with Unbounded_String, and where Chunked_String turns out to be as efficient, or slightly, that's exactly the same waste of time and effort, without premature optimization or any evil. Other the other hand, using an interface like String_Accumulator instead of static calls, if it were only for performance consideration, and if it turns out that the dynamic dispatch is doing irreparable damage to performance, to the point of having to rewrite the thing with static calls, then it would be evil because of the rewriting work needed repair the code. At least that's how I've always understood it. Re-reading the context of Knuth's quote, "these attempts at efficiency actually have a strong negative impact when debugging and maintenance are considered." The mere existence of an optimized version of an existing module, that can be plugged effortlessly into or out of the project, has no debugging or maintenance impact at all. Natasha