Boost logo

Boost Users :

From: Brian Budge (brian.budge_at_[hidden])
Date: 2006-05-08 14:23:20

Thanks for the ideas guys.

Compile options are like so:
g++ -O3 -msse -mfpmath=sse

I tried the metaprogramming technique (which is pretty nifty :) ), and
got interesting results.

Basically, it made my += operator run twice as SLOW, while making my +
operator run twice as FAST.

I have a feeling that this is all due to the different optimizations
that gcc is doing at multiple stages of compilation. For example, it
may be doing autovectorization of the simple loop case of +=, which it
can't figure out with the metaprogramming technique. I'm still
stumped as to why I'm roughly an order of magnitude slower with + than
with +=.

Any more insights?

Thanks again for the ideas so far!

On 5/8/06, John Maddock <john_at_[hidden]> wrote:
> > Any ideas how to increase the performance of the new code here? A
> > factor of 10 makes it seem like I am just missing something important.
> I would suspect it's the loop that's at fault, although very I'm surprised
> it's a factor of 10. Your original code had the loop unrolled, so you might
> try a bit of template metaprogramming to achieve the same effect here.
> Otherwise you're going to have to do a bit of debugging and/or inspection of
> the assembly generated.
> BTW the measurements you made were in release mode right? If inline
> expansions are turned off (debug mode for example) the operators-based
> version may well pass through many more function calls. Of course these all
> disappear as long as your compiler does a reasonable job of inlining.
> HTH, John.
> _______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at