Boost logo

Boost :

From: Eric Niebler (eric_at_[hidden])
Date: 2008-03-18 11:25:49

Markus Werle wrote:
> Eric Niebler <eric <at>> writes:
>> The reason I ask is because if you use expr<>,
>> you are limited to BOOST_PROTO_MAX_ARITY elements, which is probably too
>> low. And bumping BOOST_PROTO_MAX_ARITY gets expensive.
> Alarm level red: You have measurements: what is the implication
> of setting BOOST_PROTO_MAX_ARITY to values greater than 10
> considering compile time?

Here are the compile times for libs/xpressive/test/test2.cpp, a fairly
rigorous workout for Proto, for different max arities.

Arity Compile time (sec)
5 5.132
10 5.725
15 6.895
20 8.517
25 11.091
30 14.492
35 18.922
40 25.100

As you can see, beyond 20 things begin to get bad, but not dramatically
so. One of the big sources of slow-down is the operator() overloads on
expr<> ... there are N specializations of expr<>, and each one has N
overloads of operator(). That's O(N^2) growth. With a variadic
operator(), I should be able to knock that down to O(N).

In picking a max arity for a DSEL, I think we reach the limits of human
readability (a function that takes 20 arguments?! Really?) before we
reach Proto's breaking point.

Eric Niebler
Boost Consulting

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