comp.lang.ada
 help / color / mirror / Atom feed
From: Ole-Hjalmar Kristensen <oleh@vlinux.voxelvision.no>
Subject: Re: Is ther any sense in *= and matrices?
Date: Tue, 10 Jun 2003 09:57:55 GMT
Date: 2003-06-10T09:57:55+00:00	[thread overview]
Message-ID: <7vel222r18.fsf@vlinux.voxelvision.no> (raw)
In-Reply-To: bebbba07.0306090946.26279267@posting.google.com

18k11tm001@sneakemail.com (Russ) writes:

> "Bobby D. Bryant" <bdbryant@mail.utexas.edu> wrote in message news:<pan.2003.06.09.14.53.15.912223@mail.utexas.edu>...
> > On Sun, 08 Jun 2003 21:27:13 -0700, Russ wrote:
> > 
> > > "Bobby D. Bryant" <bdbryant@mail.utexas.edu> wrote in message
> > > news:<pan.2003.06.08.22.56.37.297066@mail.utexas.edu>...
> > >> On Sun, 08 Jun 2003 11:51:31 -0700, Russ wrote:
> > >> 
> > >> > "John R. Strohm" <strohm@airmail.net> wrote in message
> > >> > news:<bbumef$fnq@library2.airnews.net>...
> >  
> > >> >> 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.
******************************************************************************



  reply	other threads:[~2003-06-10  9:57 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-05 10:45 Is ther any sense in *= and matrices? Preben Randhol
2003-06-05 11:13 ` Vinzent Hoefler
2003-06-05 11:28   ` Preben Randhol
2003-06-05 11:53     ` Vinzent Hoefler
2003-06-05 15:27       ` Preben Randhol
2003-06-05 15:40         ` Vinzent Hoefler
2003-06-05 15:47           ` Preben Randhol
2003-06-05 16:38             ` Vinzent Hoefler
2003-06-05 17:16               ` Preben Randhol
2003-06-05 17:17               ` Preben Randhol
2003-06-05 17:59                 ` Vinzent Hoefler
2003-06-07 19:38             ` Russ
2003-06-08  6:46               ` John R. Strohm
2003-06-08 18:51                 ` Russ
2003-06-08 20:52                   ` tmoran
2003-06-09  4:24                     ` Russ
2003-06-09  5:13                       ` John R. Strohm
2003-06-10  9:38                         ` Ole-Hjalmar Kristensen
2003-06-10 16:11                           ` Wesley Groleau
2003-06-10 19:24                             ` Ole Kristensen
2003-06-10 18:33                           ` Russ
2003-06-10 23:16                             ` John R. Strohm
2003-06-09  6:58                       ` tmoran
2003-06-08 22:23                   ` John R. Strohm
2003-06-09  6:06                     ` Russ
2003-06-09 10:06                       ` Mango Jones
2003-06-08 22:56                   ` Bobby D. Bryant
2003-06-09  4:27                     ` Russ
2003-06-09  5:17                       ` John R. Strohm
2003-06-09 14:53                       ` Bobby D. Bryant
2003-06-09 17:46                         ` Russ
2003-06-10  9:57                           ` Ole-Hjalmar Kristensen [this message]
2003-06-05 12:33     ` John R. Strohm
2003-06-05 19:25   ` Wesley Groleau
2003-06-05 20:17     ` David C. Hoos
2003-06-05 20:52       ` Wesley Groleau
  -- strict thread matches above, loose matches on Subject: below --
2003-06-10 19:00 tmoran
2003-06-10 19:37 ` Ole Kristensen
2003-06-10 19:37 ` Ole Kristensen
2003-06-10 19:48 ` Ole Kristensen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox