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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dab7d920e4340f12 X-Google-Attributes: gid103376,public X-Google-Thread: 1014db,dab7d920e4340f12 X-Google-Attributes: gid1014db,public From: clodius@hotspec.lanl.gov (William Clodius) Subject: Re: C is 'better' than Ada because... Date: 1996/08/01 Message-ID: #1/1 X-Deja-AN: 171562337 sender: clodius@hotspec.lanl.gov organization: Los Alamos National Laboratory newsgroups: comp.lang.ada,comp.lang.c Date: 1996-08-01T00:00:00+00:00 List-Id: In article <01bb7fd4$6a0f4300$87ee6fce@timpent.airshields.com> "Tim Behrendsen" writes: I had an [ex-]employee who wrote the slowest code on the face of the earth. Because of performance problems in our application, I went through and analyzed his code. The man almost never used pointers, and almost always used array accesses. These algorithms were much more complex that the trivial examples we've been talking about. I rewrote the subroutines to use pointers, and with an eye toward easy optimization by the compiler. The algorithms used were exactly the same; I just reworked the stylistic expression of them. I didn't view the assembly language output, or anything processor specific like that. I simply coded things in a straightforward data-flow sort of way, keeping the amount of context information that the compiler needed at any one point in the subroutine to a minimum. I was easily able to get 3-4x performance improvements. This anecdote by itself says nothing. It says that you had an employee wrote slow code and that he used arrays. Unfortunately, because you never determined the specific sources of the inefficiencies, it does not say that the slow code was due to the use of arrays. It could very well be due to the misuse of arrays, in particular if he used column major order instead of C's preferred row major order, or due to entirely different reasons. It is possible for a knowledgeable person to write very efficient code using arrays. -- William B. Clodius Phone: (505)-665-9370 Los Alamos National Laboratory Email: wclodius@lanl.gov Los Alamos, NM 87545