Boost logo

Boost :

From: Larry Evans (cppljevans_at_[hidden])
Date: 2008-03-17 16:09:22


On 03/16/08 12:39, Max Motovilov wrote:
[snip]
>> other implementations. If you post your benchmark, I could
>> actually make a comparison.
>
> Attaching the test program along with both versions of the
> product_view<>. I used the following [bash] commands to benchmark it:
>
> > for n in 1 2 3 4 5 6 7 8 9;
> > do time g++-4.2 -DCOUNT=$n test_product_view.cpp;
> > done
>
> and
>
> > for n in 1 2 3 4 5 6 7 ;
> > do time g++-4.2 -DCOUNT=$n -DRECURSIVE test_product_view.cpp;
> > done

Thanks!

> Note that both my versions produce flattened view (a sequence of tuples
> which are sequences of the same kind as the top-level sequence of the
> argument). Whether the flattened or the nested representations are more
> correct is, of course, a philosophical question -- but I originally
> needed the flattened view for my particular application.

I finally looked more closely at your code and it doesn't use
views as mine does. The reason I used views was because that
was what the book exercise requested. On closer inspection,
I'm guessing that your using a vector of "overflow" iterators,
where the size of the vector is the number of domains, and
each increment of the iterator increments the last element
of the vector until it reaches the end, then resets that
one and increments the previous overflow iterator in
the vector. Is that about right?

This seems pretty good to me and I don't see how the one I produced
could beat that. I may just try it anyway just to see.

-regards,
Larry


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk