On 30/12/2011 17:34, Bart Janssens wrote:

On Fri, Dec 30, 2011 at 7:01 AM, Eric 
Niebler<eric-xT6NqnoQrPdWk0Htik3J/w...@public.gmane.org>  wrote:
Are you certain your problem is caused by using operator() for grouping?
I think this is just a very big expression template, and any syntax you
choose for grouping will result in long compile times and heavy memory
usage.

Yes, that's what I mean, the way grouping works now always creates a
huge expression.

You cant really do anything else. ET captures the whole AST and this AST has to be stored somehow.

Can I ask, what version of Boost are you using? I see you #define
BOOST_PROTO_MAX_ARITY to 10 at the top. In recent versions of Proto, 10
is the default. And newer Proto versions already make use of variadic
templates for operator() if available.

I'm using 1.46.1 for now. Good to hear variadic templates are already
available for this, do I need to do anything explicit to enable them,
such as add a compile option?


Compiles in C++11 mode : --std=c++0x

Other things to think about: does this really need to be all one big
expression, or can parts of it be broken up and type-erased, as with
spirit::qi::rule?

Not sure how this type-erased method works, but all of the expressions
are ran in a tight loop, so I'd like to avoid the overhead of having
to go through a virtual call. Also, I use some introspection across
the whole expression to determine which variables exist.

type erasure allow your template class to inherit from a single, non-template base class that forward its evaluation to its actual
derived class via a single virtual member function entry-point.

At some point, you need to do this or your CT just explode. And for your
performance matter, I think it need to be benched, type erased calls usually are no more than some cycles slower to call.

On the front of introspection, we found out in NT2 that performing some
introspecting tasks in the expression generator (when it made sense) helped keep the CT madness low as the resulting AST can be trimmed as soon as it is built. Not sure if it applies here.
_______________________________________________
proto mailing list
proto@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/proto

Reply via email to