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-10 02:58:26 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!news.teledanmark.no!news.equant.no!uio.no!193.75.75.20.MISMATCH!news.eunet.no!dax.net!juliett.dax.net!not-for-mail Newsgroups: comp.lang.ada Subject: Re: Is ther any sense in *= and matrices? References: From: Ole-Hjalmar Kristensen Message-ID: <7vel222r18.fsf@vlinux.voxelvision.no> User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 10 Jun 2003 09:57:55 GMT NNTP-Posting-Host: 193.216.12.150 X-Complaints-To: abuse@tele2.no X-Trace: juliett.dax.net 1055239075 193.216.12.150 (Tue, 10 Jun 2003 11:57:55 MET DST) NNTP-Posting-Date: Tue, 10 Jun 2003 11:57:55 MET DST Organization: Tele2 Norway AS Public Access Xref: archiver1.google.com comp.lang.ada:38891 Date: 2003-06-10T09:57:55+00:00 List-Id: 18k11tm001@sneakemail.com (Russ) writes: > "Bobby D. Bryant" wrote in message news:... > > On Sun, 08 Jun 2003 21:27:13 -0700, Russ wrote: > > > > > "Bobby D. Bryant" wrote in message > > > news:... > > >> On Sun, 08 Jun 2003 11:51:31 -0700, Russ wrote: > > >> > > >> > "John R. Strohm" wrote in message > > >> > news:... > > > > >> >> With all due respect, ladies and gentlemen, it has been known for a > > >> >> very long time that the difference in "efficiency" between A := A + > > >> >> B and A += B is lost in the noise floor compared to the improvements > > >> >> that can be gotten by improving the algorithms involved. > > >> > > > >> > 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 > > >> > just shy of a factor of 3, folks. If that's your "noise floor," I > > >> > can't help wonder what kind of "algorithms" you are dealing with! > > >> > > >> I'm just curious why the compiler didn't generate the same code for > > >> both versions. > > > > > > The compiler didn't generate the code. I did. > > > > No, I'm talking about the compiler's machine-code output. You wrote in > > C++, right? > > Yes, I wrote it in C++. I would not have expected the compiler to > generate the same code for both versions. I did not use any > optimization flag, by the way, but even if I had, I still would not > have expected the same executable. If you think it should, your beef > is with the gcc folks. You cannot do source level optimizations based on runs with the optimizer turned off. For example, you usually need some level of optimization to turn inlining on, and without inlining, the peephole optimizer cannot do as much. When that is said, my run of tmoran's code shows a relatively large performance penalty for the function version, which supports your argument. It just shows that you cannot expect the same results on different systems. oleh@VOLGA /cygdrive/c/div $ g++ -O3 -funroll-loops -o moran-add moran-add.cpp oleh@VOLGA /cygdrive/c/div $ time ./moran-add Go 1000 180 450 real 0m0.655s user 0m0.660s sys 0m0.010s Ole-Hj. Kristensen ****************************************************************************** * You cannot consistently believe this sentence. ******************************************************************************