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,99a6311c4195e21b X-Google-Attributes: gid103376,public From: Jeffrey L Straszheim Subject: Re: Matrix Multiplication Date: 1999/12/27 Message-ID: <3868343D.ACF2EBD7@shadow.net>#1/1 X-Deja-AN: 565540060 Content-Transfer-Encoding: 7bit References: <385699B5.59C14D03@lmco.com> <3856C9A1.F89EFD8@maths.unine.ch> <5l1f5s4kck891a2s6o8bhvkirm4q79hm6c@4ax.com> <3857B51F.4B1E0F1E@maths.unine.ch> <3857D640.C1991F0C@quadruscorp.com> <385811F7.F3FFEB06@maths.unine.ch> <38592664.700D776B@quadruscorp.com> Organization: I've tried organization, but it just didn't work for me. Content-Type: text/plain; charset=us-ascii MIME-Version: 1.0 Newsgroups: comp.lang.ada X-Complaints-To: newsabuse@supernews.com Date: 1999-12-27T00:00:00+00:00 List-Id: Marin D. Condic wrote: > I'll take your word for that. Still, it seems to look like in *most* > cases Ada and Fortran ought to be able to generate equally efficient > code for the garden variety floating point math and array reference > operations. The rest is arguing about the relative quality of different > compilers. That is the grand misunderstanding of so many people who say > "Ada makes slower code than Fortran for XYZ..." I probably don't know what I'm talking about here, but one big advantage Fortran seems to have over languages in the C family is its lack of aliasing. That is, in Fortran the compiler can usually assume that an array element will only be accessed from within that array, and can aggressively optimize. For instance in C: void some_function (int x[], int length, int *something) { int k; for (k = 1; k < length; ++k) { *something = x[k] + x[k-1]; } } For this function, the compiler cannot: 1. Assume that 'length' is constant -- which might have allowed some optimization. 2. Remember, in a register, the current iteration's 'x[k]', which could be used as the next iteration's 'x[k-1]'. Fortunately, 'k' is local. Had it been global (yuck) then the compiler couldn't even make any assumptions about 'k'. Given Ada's more restrictive use of and more strict typing, it should do better than C, but perhaps not as well as Fortran for some such loops. All this being said, I understand that new Fortrans allow some limited types of aliasing (or maybe they don't). If so perhaps even this advantage is lost. -- Jeffrey Straszheim -- Systems Engineer, Programmer -- http://www.shadow.net/~stimuli -- stimuli AT shadow DOT net