Boost logo

Boost :

From: Andy Little (andy_at_[hidden])
Date: 2006-09-09 15:16:33

"Geoffrey Irving" <irving_at_[hidden]> wrote in message
> On Sat, Sep 09, 2006 at 06:27:40PM +0800, Joel de Guzman wrote:
>> Andy Little wrote:
>> >> You must've missed this: Dan wrote me an email a while back. He
>> >> says: "Interestingly using fusion::fold to do maths on boost::arrays,
>> >> I'm finding that with vc8.0 fusion significantly outperforms the
>> >> standard library equivalent code, presumably as it has more
>> >> information available at compile time, and with inlining it
>> >> effectively unrolls the entire loops."
>> >>
>> >> I asked Dan to add his tests to libs/fusion/example to showcase
>> >> this favorable "phenomena" :-).
>> >
>> > I can't find that, but I am probably looking in the wrong place. Do you
>> > mean
>> > Boost CVS?
>> Sorry, you'll have to wait a bit more. Dan says he'll do it over
>> the weekend.
> I think the main reason for this is that inlining a fusion loop means that
> the compiler has obeyed an explicit programmer suggestion (inline), whereas
> unrolling a constant size array loop is loop unrolling, which is impossible
> to suggest to the compiler (and typically requires higher -O levels, etc.).
> A while back when I implemented a vector type with constant size for loops,
> it slowed down the whole application by 30%.
> I'm very curious to see how much better fusion can do. Andy: is your
> fusion code in an easily accessible place where I could grab it and stick
> some of it into our vector class to test it in a (probably) larger example?

The code is in quan CVS. Heres the info page:

The module name is quan-trunk

Unfortunately there are quite a few dependencies on the rest of the Quan stuff.
To use it direct you will need to download everything and point the compiler at
the quan directory.
The dot_product is implemented in <quan-trunk/quan/fusion/dot_product.hpp>
OTOH You could however just download that header and replace the functors
quan::operator_plus, quan::operator_plus_equals, and quan::operator_multiplies
( and swap_args) with your own versions which *should* remove the dependencies,
but you will need to look at the <quan/fusion/swap_args.hpp> header to get the
boost::reference_wrapper signatures for assignment

There is an example use in <quan-matters/examples/fusion/dot_product.cpp>.

Andy Little

Boost list run by bdawes at, gregod at, cpdaniel at, john at