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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b375f07e05d12c7a X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-14 01:59:11 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!news-FFM2.ecrc.net!news.iks-jena.de!lutz From: lutz@iks-jena.de (Lutz Donnerhacke) Newsgroups: comp.lang.ada Subject: Re: efficient vector/matrix operations in Ada Date: Tue, 14 Aug 2001 08:56:51 +0000 (UTC) Organization: IKS GmbH Jena Message-ID: References: <3B6F40C1.FD215D1D@sneakemail.com> <3B6F5ABC.3C40E189@sneakemail.com> <9f6e2b77.0108100854.66b084b4@posting.google.com> <3B783732.A3A1EB82@mindspring.com> NNTP-Posting-Host: taranis.iks-jena.de X-Trace: branwen.iks-jena.de 997779411 28497 217.17.192.37 (14 Aug 2001 08:56:51 GMT) X-Complaints-To: usenet@iks-jena.de NNTP-Posting-Date: Tue, 14 Aug 2001 08:56:51 +0000 (UTC) User-Agent: slrn/0.9.6.3 (Linux) Xref: archiver1.google.com comp.lang.ada:11897 Date: 2001-08-14T08:56:51+00:00 List-Id: * Russ wrote: >Larry Hazel wrote in message news:<3B783732.A3A1EB82@mindspring.com>... >> Seems to me if a compiler can't generate the most efficient code for >> A = B + C + D >> or >> A := B + C + D >> in any language, you need a different compiler. > >I'm no compiler expert, but I seriously doubt that you are correct here. >Come to think of it, I'll just say that you are flat out wrong--and I'll >eat crow if you are right. The difference (in C++) between > > A = B + C + D; >and > A = B; A += C; A += D; > >is more fundamental than a compiler can account for. Don't forget that >"+" and "+=" are user-defined operators to start with. The former says >to add B, C, and D, place the result in a temporary matrix, and copy >that matrix by value back into A. Even the dragon book contains a chapter about data flow analysis, which is invented to remove unnecessary temporary copies and does a wonderful job on this subject.