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,8c8550b9f2cf7d40 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-08 22:21:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news.airnews.net!cabal12.airnews.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: Is ther any sense in *= and matrices? Date: Mon, 9 Jun 2003 00:13:45 -0500 Organization: Airnews.net! at Internet America Message-ID: References: Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Mon, 09 Jun 2003 00:20:48 -0500 (CDT) NNTP-Posting-Host: !\p8l1k-V\n`(V3 (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Xref: archiver1.google.com comp.lang.ada:38846 Date: 2003-06-09T00:13:45-05:00 List-Id: "Russ" <18k11tm001@sneakemail.com> wrote in message news:bebbba07.0306082024.7cebb5df@posting.google.com... > tmoran@acm.org wrote in message news:... > > >Oh, really? I just did a test in C++ with 3x3 matrices. I added them > > >together 10,000,000 times using "+", then "+=". The "+=" version took > > >about 19 seconds, and the "+" version took about 55 seconds. That's > > Would you be so kind as to post your code, and what C++ compiler > > and what hardware you used? Your results seem quite different from > > other people's. My old 900MHz Windows 2K machine using MSVC++ 5.0 > > took 4.38 and 3.28 seconds, a factor of 1.33, and using Gnat 3.15p > > on the same machine took 1.38 and 0.85 seconds, a ratio of 1.6 > > Clearly, there's something substantially different between our > > compilers/hardware/code. > > I'm using gcc 2.95.2 on a Sunblade 2000. I can't post the code, but it > is a pretty standard vector/matrix implementation in C++. Actually, it > is designed for very efficient indexing, perhaps at the expense of > slightly less efficient construction (it has a pointer for each row of > the matrix). That might explain part of the difference you are seeing, > but certainly not all. Perhaps your choice of C++ compiler is a factor > too. I think the point that Tom is trying to make is that your results are so far out of line with expected reality that he suspects that your optimizations for indexing may in fact be pessimizations. Without seeing your code, we aren't going to be able to tell very much. There is also this. You're on a Sunblade. I'm guessing that is a PowerPC. PowerPC cache effects can do horrendous things to your runtime, and very minor changes in code structure, that affect the cache hit pattern, can have VERY disproportionate effects. (It is not at all hard to see an order of magnitude slowdown.) Mercury Computer went to a great deal of trouble to show this to us, and teach us how to exploit it properly, in the RACEway programming class. (And I'm the guy who took one of their examples, that they believed was as good as it was possible to get it, and got another 5% speedup out of it. They were rather surprised.)