Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-04-16 16:56:32

----- Original Message -----
From: "Hamish Mackenzie" <hamish_at_[hidden]>

> The thing is that gcc seems to do a very good job at simple top-level
> recursion. I upped the list size to 200 and it still took around 4
> seconds to compile. This goes up to 9 seconds if I get it to return a
> boolean value.

Without the loop unrolling (and possibly even with the loop unrolling)
it still isn't too surprising that the [pre-review] MPL implementation
is slower than raw typelist manipulation. It has always been Aleksey's
intention to provide optimized algorithm specializations for particular
compilers and sequence implementations.

> I also tried this....
> namespace boost{ namespace mpl {
> template< typename State, typename ForwardOp >
> struct fold< null_node, State, ForwardOp, project1st<_,_> >
> {
> typedef State type;
> };
> template< class Head, class Tail, typename State, typename ForwardOp >
> struct fold< list_node< Head, Tail >, State, ForwardOp,
> >
> {
> typedef typename fold<
> Tail,
> typename ForwardOp::apply< State, Head >::type,
> ForwardOp,
> project1st< _, _ > >::type type;
> };
> } }
> Which started getting slow around N=18 (took 18.15 seconds).

I'm not exactly sure what the above shows. It looks as though you've
partially-specialized fold<> to work on lists with project1st... is it
faster than the unspecialized version?

If you're interested in contributing optimized versions of some of the
MPL algorithms I'm sure it would be greatly appreciated.


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