Boost logo

Boost :

From: Hamish Mackenzie (hamish_at_[hidden])
Date: 2002-04-16 11:22:32


On Tue, 2002-04-16 at 16:43, David Abrahams wrote:
> It doesn't surprise me. See
> http://users.rcn.com/abrahams/instantiation_speed/index.html. The
> implementations of template matching in some of these compilers is...
> well, let's just say it wasn't designed with metaprogramming in mind.
> Lots of linear list searches, for example.

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.

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, project1st<_,_>
>
{
        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).

Hamish


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