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,38fc011071df5a27 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-04 06:44:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!newshub.sdsu.edu!logbridge.uoregon.edu!newsfeed.vmunix.org!peer02.cox.net!peer01.cox.net!cox.net!news-hub.cableinet.net!blueyonder!internal-news-hub.cableinet.net!news-binary.blueyonder.co.uk.POSTED!53ab2750!not-for-mail User-Agent: Microsoft-Entourage/10.1.1.2418 Subject: Re: Ideas for Ada 200X From: Bill Findlay Newsgroups: comp.lang.ada Message-ID: References: <7vu1b640gf.fsf@vlinux.voxelvision.no> Mime-version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-transfer-encoding: 7bit Date: Wed, 04 Jun 2003 14:43:17 +0100 NNTP-Posting-Host: 80.195.75.181 X-Complaints-To: abuse@blueyonder.co.uk X-Trace: news-binary.blueyonder.co.uk 1054734264 80.195.75.181 (Wed, 04 Jun 2003 13:44:24 GMT) NNTP-Posting-Date: Wed, 04 Jun 2003 13:44:24 GMT Organization: blueyonder (post doesn't reflect views of blueyonder) Xref: archiver1.google.com comp.lang.ada:38595 Date: 2003-06-04T14:43:17+01:00 List-Id: On 4/6/03 11:10, in article 7vu1b640gf.fsf@vlinux.voxelvision.no, "Ole-Hjalmar Kristensen" wrote: > I think the difference between C++ and Ada is the compiler. I run both > through gcc, and got identical results. The function "+" is about > three times slower on my system, as you can see. This is a bit > disappointing, I'll run it through gcc 3.2 later and see if it does > any better. ... > procedure Matrix_fun is > subtype M_Index is Integer range 1..100; > type Matrices is array(M_Index,M_Index) of Integer; > > function "+"(M1,M2: Matrices) return Matrices is > Tmp : Matrices := M1; Why the redundant copy? ^ > begin > for I in M1'Range(2) loop > for J in M1'Range(1) loop > Tmp(I,J) := M1(I,J) + M2(I,J); N.B. Not Tmp............^ > end loop; > end loop; > return Tmp; > end "+"; > pragma Inline("+");