Re: PROFESSIONAL floating-point algorithms.

From: Richard Heathfield (dontmail_at_address.co.uk.invalid)
Date: 01/04/04


Date: Sun, 4 Jan 2004 08:38:14 +0000 (UTC)

Edward G. Nilges wrote:

> Ben Pfaff <blp@cs.stanford.edu> wrote in message
> news:<87hdzc7qx1.fsf@pfaff.stanford.edu>...
>> "Arthur J. O'Dwyer" <ajo@nospam.andrew.cmu.edu> writes:
>>
>> > On Sat, 3 Jan 2004, Charles Douglas Wehner wrote:
>> > > http://www.wehner.org/fpoint/
>> >
>> > Ow! My eyes!
>>
>> Looks okay to me. 'Course, I used a text-based browser to view
>> it.
>
>
> Like your sig because I saw it long ago:
>
> "Premature optimization is the root of all evil."
> --D. E. Knuth, "Structured Programming with go to Statements"
>
> This applies of course to strlen() flames, doesn't it.

No. Knuth's intent was not that programs should be written to perform as
slowly as possible. Choosing an appropriate algorithm and implementing it
correctly does not constitute premature optimisation.

Loop unrolling is a good example of premature optimisation.

> In fact, I find it necessary to explain my mental categories, not to
> lesser minds but minds without my advantages. I was employed by
> Princeton University (gee, we know this now)

Oh? When did we learn this independently?

<off-topic stuff snipped>

> In computing science and its ethics, I take Knuth to mean that as a
> matter of strict, "lexical" priority, it is malpractice (and should be
> legally actionable malpractice) to use any form of coding trick to
> make your code fast BEFORE you have a prototype that works.

It is no "trick" to choose your algorithm intelligently and implement it
properly.

> Of course, my legalistic view is shall we say unusual.

It is, in fact, stupid. Whilst I agree that it is easier to make a correct
program fast than it is to make a fast program correct, that does not mean
we are obliged to ignore all we know about good programming practice when
writing the initial code.

> Most programmers unlike me come from an engineering background in
> which it's natural to make compromises and trade offs at all points in
> the project lifecycle. The problem is that such compromises are the
> problem as when a multiple threaded (or multiple process, dammit all
> to hell and gone) system is moved onto a faster CPU and stops working.

Can you name a specific CPU on which, for the same input data and for a
string s of a given length:

size_t len = strlen(s);
while(i < len)
{
  dostuff(i);
}

will fail but:

while(i < strlen(s))
{
  dostuff(i);
}

will work? And if you can, was this CPU designed by Edward G Nilges?

<nonsense snipped>

-- 
Richard Heathfield : binary@eton.powernet.co.uk
"Usenet is a strange place." - Dennis M Ritchie, 29 July 1999.
C FAQ: http://www.eskimo.com/~scs/C-faq/top.html
K&R answers, C books, etc: http://users.powernet.co.uk/eton


Relevant Pages

  • Re: PROFESSIONAL floating-point algorithms.
    ... proto-Fascist societies to believe that the reverse of a universal ... >> to hell and gone) system is moved onto a faster CPU and stops working. ... was this CPU designed by Edward G Nilges? ...
    (comp.programming)
  • Re: Sequence points
    ... If I type in "Edward" and hit the return key. ... I run it again, this time I type in "Edward G. Nilges, Esquire" and hit ... aka spinoza1111 appears to have a bad habit ... Using a slightly different version of the compiler and/or compiler ...
    (comp.programming)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... > Edward G. Nilges wrote: ... wasn't meant for ADP (Administrative Data Processing), ... with DAC like machines (Digital Analog Computers) like the ...
    (comp.programming)
  • Re: what does "serialization" mean?
    ... statistics. ... The other 20% are caused by top posting. ... > Edward G. Nilges wrote: ...
    (comp.programming)
  • Re: Chris Sonnack on VB.Nets putative Set statement
    ... Before I finished reading this all the way through and prior ... he would prevaricate and avoid the truth. ... -- Edward G. Nilges ...
    (comp.programming)