Boost logo

Boost :

Subject: Re: [boost] [metaparse] Review period starts May 25th and ends June 7th - ongoing
From: Abel Sinkovics (abel_at_[hidden])
Date: 2015-06-08 01:03:26

Hi Lee,

Thank you for the review.

On 2015-06-08 04:34, Lee Clagett wrote:
> * Adding support for the Gcc character-literal expansion extension would be
> nice, because the strings macro has some intense pre-processor work.
Do you mean multi-character literals? (eg. 'abcd'?)

> * Compiling in C++11 mode is noticeably quicker for some of the examples I
> tried (in clang and gcc) - due to the true variadic string implementation
> (no pre-processor)?
I'm not aware of a speed gain in switching to C++11 mode. Could you
point me to the example and the compiler version/flags you were using?
I'd like to learn more about where that comes from (it could be useful
to reduce compilation times).

What I'm aware of is that some of the examples only print "Please use a
compiler that support constexpr" when the string macro is not supported
(eg. calculator_with_parens_and_unary_ops example). Because of this, in
pre-C++11 mode, they compile quicker as they don't run the metaprograms.

> ** I noticed some of the other areas used pre-processor variadics (one_of,
> etc.), could C++11 variadics improve compilation time here?
I'm planning to add C++11 support to those places. Mainly to remove the
length limit (eg. the number of cases one can use in one_of), but there
might be speed improvements as well (I'll need to check).

> ** Using boost::mpl::vector for sequences/repeats feels ancient, could this
> be moved to a mpl conformant C++11 variadic implementation too? mpl has
> pre-processed headers, but still have lots of symbols/code for the compiler
> to parse and manage for the variations. Since the documentation states that
> the repetition/sequence based parsers return a "implementation-defined" mpl
> sequence, could this data structure be swapped in c++11 mode? Unfortunately
> I can't find a compile-time performance comparison of mpl::vector and a
> similar data structure using C++11 variadics.
Yes, it definitely could and should be replaced where possible. The
question is "how?".

I've been using mpl::vector as it works on older platforms as well and
I've been waiting for a variadic template-based (meta)container to be
added to Boost (I didn't want other dependencies and have not
investigated building it myself). The interface is based on MPL's
sequence abstraction, so as long as the thing returned supports it (the
docs could be more specific on the type of sequence), it should be
swappable when further/better containers become available.

> The compile-times I experienced were not great. A decent portion may have
> been due to the usage of spirit, another library known to have significant
> compile times. The (somewhat) simple calculator example still takes ~2.5s
> to compile in clang 3.5 C++11 mode. This was on an older laptop, maybe I
> should just upgrade. Although it would be nice to see if there are ways to
> improve on the compilation time - otherwise people might avoid this
> library. The framework that Louis mentioned previously seems worthwhile.
I'll investigate how to make compilation faster.


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